{"id":725,"date":"2017-04-30T15:34:59","date_gmt":"2017-04-30T07:34:59","guid":{"rendered":"http:\/\/www.rain1024.com\/?p=725"},"modified":"2023-08-07T20:57:28","modified_gmt":"2023-08-07T12:57:28","slug":"js-article77","status":"publish","type":"post","link":"http:\/\/rain1024.com\/index.php\/2017\/04\/30\/js-article77\/","title":{"rendered":"JS\u5b9e\u73b0\u8dd1\u9a6c\u706f\u6548\u679c"},"content":{"rendered":"<p>JS\u5b9e\u73b0\u8dd1\u9a6c\u706f\u6548\u679c<\/p>\n<h3>\u4e0a\u8bfe\u65e0\u804a\uff0c\u6ca1\u4e8b\u5199\u4e00\u4e2a\u73a9\u4e00\u73a9\uff0c\u4f7f\u7528\u7ea2\u9ec4\u7eff\u4e09\u79cd\u4e5f\u662f\u5207\u6362\uff0c\u7528js\u5199\u4e00\u4e2a\u989c\u8272\u5224\u65ad\u7684\u51fd\u6570\uff0c\u518d\u7528<code>setInterval('color()',100);<\/code>\u8c03\u7528\u51fd\u6570\uff0c100\u4e3a0.1\u79d2\uff0c\u4e0b\u9762\u662f\u4ee3\u7801\uff0c\u60f3\u8981\u770b\u6548\u679c\u7684\u6233\u8fd9\u91cc<a href=\"http:\/\/www.rain1024.com\/page\/js77.html\">www.rain1024.com-js77<\/a><\/h3>\n<h3>\u4e0b\u9762\u662f\u4ee3\u7801<\/h3>\n<pre><code class=\"html\">&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n&lt;head&gt;\n    &lt;meta charset=\"UTF-8\"&gt;\n    &lt;title&gt;&lt;\/title&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n&lt;style&gt;\n    .content{\n        background-color: red;\n        width: 200px;\n        height: 200px;\n        margin: auto;\n        margin-left: 50px;\n        color: chartreuse;\n        float:left;\n    }\n    .content2{\n        background-color: red;\n        width: 200px;\n        height: 200px;\n        margin: auto;\n        color: chartreuse;\n    }\n    .figure{\n        width: 800px;\n        height: 100px;\n        \/*background-color: #FFFFFF;*\/\n    }\n    .all{\n        width: 900px;\n        height: 200px;\n        margin: auto;\n    }\n&lt;\/style&gt;\n&lt;script&gt;\n    \/\/    \u8bbe\u7f6e\u6bcf\u79d2\u5237\u65b0\u4e00\u6b21\n    function myshuaxing() {\n        window.location.reload();\n    }\n\/\/    setTimeout('fun()',2000);\n    setInterval('color()',100);\n\/\/    setInterval('color_out()',1000);\n\/\/    setTimeout('color_out()',1000);\n&lt;\/script&gt;\n&lt;script type=\"text\/javascript\"&gt;\n\/\/    setTimeout('color_over()',2000);\n\/\/    setTimeout('color_out()',2000);\n\/\/    alert('123');\n    function fun(value){\n        var value = prompt('324');\n        if(value==1){\n            document.getElementById('state').innerHTML = 'true';\n        }else{\n            document.getElementById('state').innerHTML = 'false';\n        }\n    }\n    function color(){\n        var show = document.getElementById('show').innerText;\n        var sum = document.getElementById('number').innerText;\n        if(show==1){\n            var value = document.getElementById('content');\n\/\/        alert(value.style.backgroundColor);\n            value.style.backgroundColor='red';\n            document.getElementById('show').innerText = 2;\n            var value = document.getElementById('content2');\n            value.style.backgroundColor = '#FFFFFF';\n            var value = document.getElementById('content3');\n            value.style.backgroundColor = '#FFFFFF';\n        }else if(show==2){\n            var value = document.getElementById('content2');\n\/\/        alert(value.style.backgroundColor);\n            value.style.backgroundColor='yellow';\n            document.getElementById('show').innerText = 3;\n            var value = document.getElementById('content');\n            value.style.backgroundColor = '#FFFFFF';\n            var value = document.getElementById('content3');\n            value.style.backgroundColor = '#FFFFFF';\n        }else{\n            var value = document.getElementById('content3');\n\/\/        alert(value.style.backgroundColor);\n            value.style.backgroundColor='chartreuse';\n            document.getElementById('show').innerText = 1;\n            var value = document.getElementById('content');\n            value.style.backgroundColor = '#FFFFFF';\n            var value = document.getElementById('content2');\n            value.style.backgroundColor = '#FFFFFF';\n        }\n        sum = parseInt(sum);\n        sum = sum + 1;\n        document.getElementById('number').innerText = sum;\n    }\n    function color_over(){\n\/\/        document.getElementById('state').innerHTML = 'true';\n        var value = document.getElementById('content');\n        value.style.backgroundColor=\"blue\";\n    }\n    function color_out(){\n    \/\/        document.getElementById('state').innerHTML = 'true';\n        var value = document.getElementById('content');\n        value.style.backgroundColor=\"red\";\n    }\n    function counter(){\n        var value1 = document.getElementById('value1').value;\n        var value2 = document.getElementById('value2').value;\n        var fig = document.getElementById('fig').value;\n        var result = 0;\n        value1 = parseFloat(value1);\n        value2 = parseFloat(value2);\n        if(fig==1){ \/\/+\n            result = value1 + value2;\n        }else if(fig==2){ \/\/-\n            result = value1 - value2;\n        }else if(fig==3){  \/\/*\n            result = value1 * value2;\n        }else if(fig==4){  \/\/ \/\n            result = value1 \/ value2;\n        }\n        document.getElementById('result').value = result;\n    }\n&lt;\/script&gt;\n&lt;div align=\"center\"&gt;\n    &lt;label id=\"show\" style=\"display: none\"&gt;1&lt;\/label&gt;\n    \u5df2\u5237\u65b0\u6b21\u6570\uff1a&lt;label id=\"number\" &gt;0&lt;\/label&gt;\n&lt;label id=\"state\" style=\"color: red;font-size: 30px;\"&gt;&lt;\/label&gt;&lt;\/div&gt;\n&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;\n&lt;div class=\"all\"&gt;\n&lt;div class=\"content\" id=\"content\" onmouseover=\"color_over();\" onmouseout=\"color_out();\"&gt;\n&lt;\/div&gt;\n&lt;div class=\"content\" id=\"content2\" onmouseover=\"color_over();\" onmouseout=\"color_out();\"&gt;\n&lt;\/div&gt;\n&lt;div class=\"content\" id=\"content3\" onmouseover=\"color_over();\" onmouseout=\"color_out();\"&gt;\n&lt;\/div&gt;\n&lt;\/div&gt;\n&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;\n\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>JS\u5b9e\u73b0\u8dd1\u9a6c\u706f\u6548\u679c \u4e0a\u8bfe\u65e0\u804a\uff0c\u6ca1\u4e8b\u5199\u4e00\u4e2a\u73a9\u4e00\u73a9\uff0c\u4f7f\u7528\u7ea2\u9ec4\u7eff\u4e09\u79cd\u4e5f\u662f\u5207\u6362\uff0c\u7528js\u5199\u4e00\u4e2a\u989c\u8272\u5224\u65ad\u7684\u51fd\u6570\uff0c\u518d\u7528set\u2026 <span class=\"read-more\"><a href=\"http:\/\/rain1024.com\/index.php\/2017\/04\/30\/js-article77\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":420,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30,32],"tags":[40,45,47],"class_list":["post-725","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-html","category-javascript","tag-css","tag-html","tag-javasciprt"],"_links":{"self":[{"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/posts\/725","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/comments?post=725"}],"version-history":[{"count":1,"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/posts\/725\/revisions"}],"predecessor-version":[{"id":1456,"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/posts\/725\/revisions\/1456"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/media\/420"}],"wp:attachment":[{"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/media?parent=725"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/categories?post=725"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/tags?post=725"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}