{"id":2050,"date":"2024-12-08T15:34:10","date_gmt":"2024-12-08T07:34:10","guid":{"rendered":"https:\/\/tobykskgd.life\/?p=2050"},"modified":"2024-12-09T20:37:24","modified_gmt":"2024-12-09T12:37:24","slug":"98","status":"publish","type":"post","link":"https:\/\/tobykskgd.life\/index.php\/98\/","title":{"rendered":"\u7b80\u6613\u535a\u5ba2\u8fd0\u884c\u65f6\u95f4\u4ee3\u7801"},"content":{"rendered":"\n<p>\u4e00\u76f4\u60f3\u7ed9\u535a\u5ba2\u52a0\u4e00\u4e2a\u5efa\u7ad9\u65f6\u95f4\u7684\u6a21\u5757\uff0c\u4f46\u662f\u770b\u522b\u4eba\u7684\u89e3\u51b3\u65b9\u6cd5\u90fd\u7565\u5fae\u6709\u70b9\u9ebb\u70e6\uff08\u61d2\u634f\uff09\uff0c\u56e0\u6b64\u4e0d\u65ad\u5728\u7f51\u4e0a\u627e\u5bfb\uff0c\u6700\u540e\u5728<a href=\"https:\/\/www.11zhang.com\/391.html\">https:\/\/www.11zhang.com\/391.html<\/a>\u627e\u5230\u4e86\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n\n\n\n<p>\u4e0d\u8fc7\u8be5\u4ee3\u7801\u6709\u4e00\u4e2aBUG\uff0c\u5c31\u662f\u5728\u7ad9\u5185\u8df3\u8f6c\u65f6\uff0c\u5efa\u7ad9\u7684\u65f6\u95f4\u5c31\u4f1a\u663e\u793a\u4e0d\u51fa\u6765\uff0c\u9700\u8981\u5237\u65b0\u7f51\u7ad9\u7684\u9875\u9762\u624d\u53ef\u4ee5\u91cd\u65b0\u770b\u5230\uff0c\u8fd9\u4e3b\u8981\u662f\u56e0\u4e3a\u539f\u4ee3\u7801\u6ca1\u6709\u4e00\u4e2a\u5f88\u597d\u7684\u81ea\u52a8\u91cd\u65b0\u6267\u884c\u7684\u529f\u80fd\uff0c\u9488\u5bf9\u6b64\u95ee\u9898\uff0c\u4e5f\u662f\u8be2\u95eeChatGPT\u8001\u5e08\uff0c\u5f88\u5feb\u554a\uff0c\u4e00\u4e0b\u5b50\u5c31\u5e2e\u6211\u89e3\u51b3\u7684\u95ee\u9898\u3002\u53ef\u4ee5\u4f7f\u7528JavaScript\u4e8b\u4ef6\u76d1\u542c\u5668\u91cd\u65b0\u6267\u884c\u811a\u672c\uff0c\u5728\u9875\u9762\u52a0\u8f7d\u548c\u6bcf\u6b21\u8df3\u8f6c\u65f6\uff0c\u76d1\u542c\u5e76\u6267\u884c\u4ee3\u7801\uff0c\u7528<code>DOMContentLoaded<\/code>\u6216<code>popstate<\/code>\u4e8b\u4ef6\u3002<\/p>\n\n\n\n<p>\u90a3\u4e0b\u9762\u5c31\u662f\u672c\u535a\u5ba2\u4f7f\u7528\u7684\u4ee3\u7801\u4e86\uff0c\u53ef\u4ee5\u653e\u5728\u535a\u5ba2\u7684\u5c0f\u5de5\u5177\u91cc\u7684<code>\u81ea\u5b9a\u4e49HTML<\/code>\u4e2d\u5373\u53ef\u3002\u5177\u4f53\u5b9e\u73b0\u6548\u679c\u5c31\u662f\u5de6\u4fa7\u680f\u529f\u80fd\u91cc\u7684\u6548\u679c\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;i class=\"fa fa-cog fa-spin fa-1x fa-fw\"&gt;&lt;\/i&gt;\n&lt;span&gt;\u672c\u7ad9\u5df2\u8fd0\u884c &lt;span id=\"days\" style=\"font-weight:800; color:#009688;\"&gt; &lt;\/span&gt; \u5929&lt;\/span&gt;\n&lt;script&gt;\n  function updateDays() {\n    let s1 = '2024-2-5';  \/\/ \u8bbe\u7f6e\u5efa\u7ad9\u65f6\u95f4\n    s1 = new Date(s1.replace(\/-\/g, \"\/\"));\n    s2 = new Date();\n    let days = s2.getTime() - s1.getTime();\n    let number_of_days = parseInt(days \/ (1000 * 60 * 60 * 24));\n    document.getElementById('days').innerHTML = number_of_days;\n  }\n\n  \/\/ \u521d\u6b21\u52a0\u8f7d\u65f6\u6267\u884c\n  updateDays();\n\n  \/\/ \u76d1\u542c\u524d\u8fdb\/\u540e\u9000\u6216\u5185\u90e8\u8df3\u8f6c\u4e8b\u4ef6\n  window.addEventListener('popstate', updateDays);\n  window.addEventListener('pushstate', updateDays);\n&lt;\/script&gt;<\/code><\/pre>\n\n\n\n<p>\u5176\u4e2d<code>s1<\/code>\u662f\u5efa\u7ad9\u65f6\u95f4\uff0c\u6839\u636e\u81ea\u5df1\u7684\u5efa\u7ad9\u65f6\u95f4\u4fee\u6539\u5373\u53ef\u3002\u7136\u540e\u4e0a\u9762\u7684<code>color<\/code>\u90e8\u5206\u662f\u5efa\u7ad9\u65f6\u95f4\u5929\u6570\u7684\u90a3\u4e2a\u989c\u8272\uff0c\u4e09\u4f4d16\u8fdb\u5236\u6570\uff0c\u6539\u6210\u81ea\u5df1\u559c\u6b22\u7684\u989c\u8272\u5373\u53ef\u3002\u5b57\u4f53\u5927\u5c0f\u4e5f\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u9700\u6c42\u4fee\u6539<code>font-weight<\/code>\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u4f60\u60f3\u5b9e\u73b0\u4e0b\u9762\u8fd9\u6837\u6bcf\u4e00\u79d2\u90fd\u968f\u65f6\u95f4\u52a8\u6001\u53d8\u5316\uff0c\u4e5f\u53ef\u4ee5\u5c1d\u8bd5\u4e0b\u9762\u7684\u4ee3\u7801\uff1a<\/p>\n\n\n\n<div style=\"text-align: center; margin: 20px 0;\">\n    <p style=\"font-size: 32px; font-weight: bold; color: #333;\">\n        \u672c\u535a\u5ba2\u59cb\u5efa\u4e8e 2024 \u5e74 02 \u6708 5 \u65e5\n    <\/p>\n    <p class=\"timer\" style=\"font-size: 24px; color: #333;\">\n        \u8ddd\u4eca\u5df2\u8270\u96be\u8fd0\u884c 0 \u5e74 0 \u5929 0 \u65f6 0 \u5206 0 \u79d2\n    <\/p>\n \n    <script>\n        \/\/ \u535a\u5ba2\u5f00\u59cb\u65f6\u95f4\n        const startTime = new Date(\"2024-02-05T00:00:00\");\n \n        \/\/ \u66f4\u65b0\u8fd0\u884c\u65f6\u95f4\n        function updateTimer() {\n            const now = new Date();\n            const diff = now - startTime; \/\/ \u65f6\u95f4\u5dee\uff08\u6beb\u79d2\uff09\n \n            const years = Math.floor(diff \/ (1000 * 60 * 60 * 24 * 365));\n            const days = Math.floor((diff % (1000 * 60 * 60 * 24 * 365)) \/ (1000 * 60 * 60 * 24));\n            const hours = Math.floor((diff % (1000 * 60 * 60 * 24)) \/ (1000 * 60 * 60));\n            const minutes = Math.floor((diff % (1000 * 60 * 60)) \/ (1000 * 60));\n            const seconds = Math.floor((diff % (1000 * 60)) \/ 1000);\n \n            \/\/ \u66f4\u65b0\u5230\u9875\u9762\n            document.querySelector(\".timer\").textContent = \n                `\u8ddd\u4eca\u5df2\u8270\u96be\u8fd0\u884c ${years} \u5e74 ${days} \u5929 ${hours} \u65f6 ${minutes} \u5206 ${seconds} \u79d2`;\n        }\n \n        \/\/ \u6bcf\u79d2\u66f4\u65b0\u4e00\u6b21\n        setInterval(updateTimer, 1000);\n \n        \/\/ \u521d\u59cb\u5316\u663e\u793a\n        updateTimer();\n    <\/script>\n<\/div>\n\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;div style=\"text-align: center; margin: 20px 0;\">\n    &lt;p style=\"font-size: 32px; font-weight: bold; color: #333;\">\n        \u672c\u535a\u5ba2\u59cb\u5efa\u4e8e 2024 \u5e74 02 \u6708 5 \u65e5\n    &lt;\/p>\n    &lt;p class=\"timer\" style=\"font-size: 24px; color: #333;\">\n        \u8ddd\u4eca\u5df2\u8270\u96be\u8fd0\u884c 0 \u5e74 0 \u5929 0 \u65f6 0 \u5206 0 \u79d2\n    &lt;\/p>\n \n    &lt;script>\n        \/\/ \u535a\u5ba2\u5f00\u59cb\u65f6\u95f4\n        const startTime = new Date(\"2024-02-05T00:00:00\");\n \n        \/\/ \u66f4\u65b0\u8fd0\u884c\u65f6\u95f4\n        function updateTimer() {\n            const now = new Date();\n            const diff = now - startTime; \/\/ \u65f6\u95f4\u5dee\uff08\u6beb\u79d2\uff09\n \n            const years = Math.floor(diff \/ (1000 * 60 * 60 * 24 * 365));\n            const days = Math.floor((diff % (1000 * 60 * 60 * 24 * 365)) \/ (1000 * 60 * 60 * 24));\n            const hours = Math.floor((diff % (1000 * 60 * 60 * 24)) \/ (1000 * 60 * 60));\n            const minutes = Math.floor((diff % (1000 * 60 * 60)) \/ (1000 * 60));\n            const seconds = Math.floor((diff % (1000 * 60)) \/ 1000);\n \n            \/\/ \u66f4\u65b0\u5230\u9875\u9762\n            document.querySelector(\".timer\").textContent = \n                `\u8ddd\u4eca\u5df2\u8270\u96be\u8fd0\u884c ${years} \u5e74 ${days} \u5929 ${hours} \u65f6 ${minutes} \u5206 ${seconds} \u79d2`;\n        }\n \n        \/\/ \u6bcf\u79d2\u66f4\u65b0\u4e00\u6b21\n        setInterval(updateTimer, 1000);\n \n        \/\/ \u521d\u59cb\u5316\u663e\u793a\n        updateTimer();\n    &lt;\/script>\n&lt;\/div>\n<\/code><\/pre>\n\n\n\n<p><code>font-size<\/code>\u3001<code>color<\/code>\u3001<code>document.querySelector(\".timer\").textContent<\/code>\u90fd\u53ef\u4ee5\u6839\u636e\u5927\u5bb6\u81ea\u5df1\u7684\u559c\u597d\u4fee\u6539\uff0c\u53cd\u6b63\u5404\u4f4d\u7684\u4ee3\u7801\u80fd\u529b\u5e94\u8be5\u90fd\u6bd4\u6211\u5f3a\uff0c\u8fd9\u4e9b\u90fd\u662f\u5c0f\u83dc\u4e00\u789f\u4e86\u3002\u548c\u524d\u9762\u7684\u7528\u6cd5\u4e00\u6837\uff0c\u653e\u5230\u4efb\u4f55\u6587\u7ae0\u6216\u8005\u5c0f\u5de5\u5177\u7684<code>\u81ea\u5b9a\u4e49HTML<\/code>\u91cc\u5373\u53ef\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u76f4\u60f3\u7ed9\u535a\u5ba2\u52a0\u4e00\u4e2a\u5efa\u7ad9\u65f6\u95f4\u7684\u6a21\u5757\uff0c\u4f46\u662f\u770b\u522b\u4eba\u7684\u89e3\u51b3\u65b9\u6cd5\u90fd\u7565\u5fae\u6709\u70b9\u9ebb\u70e6\uff08\u61d2\u634f\uff09\uff0c\u56e0\u6b64\u4e0d\u65ad\u5728\u7f51\u4e0a\u627e\u5bfb\uff0c\u6700\u540e\u5728htt [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2067,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[32,37],"class_list":["post-2050","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-jc","tag-share","tag-jc"],"_links":{"self":[{"href":"https:\/\/tobykskgd.life\/index.php\/wp-json\/wp\/v2\/posts\/2050","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tobykskgd.life\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tobykskgd.life\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tobykskgd.life\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tobykskgd.life\/index.php\/wp-json\/wp\/v2\/comments?post=2050"}],"version-history":[{"count":10,"href":"https:\/\/tobykskgd.life\/index.php\/wp-json\/wp\/v2\/posts\/2050\/revisions"}],"predecessor-version":[{"id":2089,"href":"https:\/\/tobykskgd.life\/index.php\/wp-json\/wp\/v2\/posts\/2050\/revisions\/2089"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tobykskgd.life\/index.php\/wp-json\/wp\/v2\/media\/2067"}],"wp:attachment":[{"href":"https:\/\/tobykskgd.life\/index.php\/wp-json\/wp\/v2\/media?parent=2050"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tobykskgd.life\/index.php\/wp-json\/wp\/v2\/categories?post=2050"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tobykskgd.life\/index.php\/wp-json\/wp\/v2\/tags?post=2050"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}