{"id":490,"date":"2025-01-15T23:12:50","date_gmt":"2025-01-15T15:12:50","guid":{"rendered":"http:\/\/sqtcw.cn\/?p=490"},"modified":"2025-01-15T23:12:50","modified_gmt":"2025-01-15T15:12:50","slug":"%e5%b8%b8%e8%a7%81%e7%9a%84html%e7%bd%91%e9%a1%b5%e7%89%b9%e6%95%88%e4%bb%a3%e7%a0%81","status":"publish","type":"post","link":"http:\/\/www.cnitw.com\/?p=490","title":{"rendered":"\u5e38\u89c1\u7684HTML\u7f51\u9875\u7279\u6548\u4ee3\u7801"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>\n\n\u6587\u672c\u7279\u6548\n \n\u6eda\u52a8\u5b57\u5e55\n \n&lt;marquee href=\"#\">\u8fd9\u662f\u4e00\u6bb5\u6eda\u52a8\u5b57\u5e55&lt;\/marquee>\n\u00a0\n \n\u8bf4\u660e\uff1a\u8fd9\u91cc\u6dfb\u52a0 \u00a0href=\"#\"\u00a0 \u662f\u4e00\u4e2a\u65e0\u6548\u94fe\u63a5\u793a\u4f8b\uff0c\u5b9e\u9645\u4f7f\u7528\u4e2d\u53ef\u66ff\u6362\u4e3a\u6709\u6548\u7684\u94fe\u63a5\u5730\u5740\uff0c\u5982 \u00a0href=\"https:\/\/example.com\"\u00a0\u3002\n \n&lt;marquee direction=\"up\" scrollamount=\"3\" loop=\"3\" href=\"https:\/\/example.com\">\u5411\u4e0a\u6eda\u52a8\u7684\u5b57\u5e55&lt;\/marquee>\n\u00a0\n \n\u6253\u5b57\u673a\u6548\u679c\n \n&lt;!DOCTYPE html>\n&lt;html>\n\n&lt;body>\n\n  &lt;div id=\"demo\">&lt;a href=\"https:\/\/example.com\">\u8fd9\u662f\u4e00\u4e2a\u53ef\u70b9\u51fb\u7684\u533a\u57df\uff0c\u7528\u4e8e\u5c55\u793a\u6253\u5b57\u673a\u6548\u679c&lt;\/a>&lt;\/div>\n\n  &lt;script>\n    var i = 0;\n    var txt = '\u8fd9\u662f\u4e00\u6bb5\u6253\u5b57\u673a\u6548\u679c\u7684\u6587\u5b57';\n    var speed = 50;\n\n    function typeWriter() {\n      if (i &lt; txt.length) {\n        document.getElementById(\"demo\").innerHTML += txt.charAt(i);\n        i++;\n        setTimeout(typeWriter, speed);\n      }\n    }\n\n    typeWriter();\n  &lt;\/script>\n\n&lt;\/body>\n\n&lt;\/html>\n\u00a0\n \n\u8bf4\u660e\uff1a\u5728 \u00a0div\u00a0 \u5185\u6dfb\u52a0\u4e86\u4e00\u4e2a\u94fe\u63a5\uff0c\u53ef\u6839\u636e\u9700\u6c42\u4fee\u6539\u94fe\u63a5\u5730\u5740\u548c\u6587\u5b57\u5185\u5bb9\u3002\n \n\u6587\u5b57\u95ea\u70c1\n \n&lt;!DOCTYPE html>\n&lt;html>\n\n&lt;head>\n  &lt;style>\n  .blink {\n      animation: blinker 1s linear infinite;\n    }\n\n    @keyframes blinker {\n      50% {\n        opacity: 0;\n      }\n    }\n  &lt;\/style>\n&lt;\/head>\n\n&lt;body>\n  &lt;span class=\"blink\">&lt;a href=\"https:\/\/example.com\">\u95ea\u70c1\u7684\u6587\u5b57\u94fe\u63a5&lt;\/a>&lt;\/span>\n&lt;\/body>\n\n&lt;\/html>\n\u00a0\n \n\u56fe\u7247\u7279\u6548\n \n\u56fe\u7247\u8f6e\u64ad\n \n&lt;!DOCTYPE html>\n&lt;html>\n\n&lt;head>\n  &lt;style>\n  .slideshow {\n      position: relative;\n      width: 500px;\n      height: 300px;\n      overflow: hidden;\n    }\n\n  .slideshow img {\n      position: absolute;\n      top: 0;\n      left: 0;\n      width: 100%;\n      height: 100%;\n      opacity: 0;\n      transition: opacity 1s;\n    }\n  &lt;\/style>\n&lt;\/head>\n\n&lt;body>\n  &lt;div class=\"slideshow\">\n    &lt;a href=\"https:\/\/example1.com\">&lt;img src=\"image1.jpg\" alt=\"\u56fe\u72471\">&lt;\/a>\n    &lt;a href=\"https:\/\/example2.com\">&lt;img src=\"image2.jpg\" alt=\"\u56fe\u72472\">&lt;\/a>\n    &lt;a href=\"https:\/\/example3.com\">&lt;img src=\"image3.jpg\" alt=\"\u56fe\u72473\">&lt;\/a>\n  &lt;\/div>\n  &lt;script>\n    var images = document.querySelectorAll('.slideshow img');\n    var currentIndex = 0;\n\n    function showNextImage() {\n      images&#91;currentIndex].style.opacity = 0;\n      currentIndex = (currentIndex + 1) % images.length;\n      images&#91;currentIndex].style.opacity = 1;\n      setTimeout(showNextImage, 3000);\n    }\n\n    showNextImage();\n  &lt;\/script>\n&lt;\/body>\n\n&lt;\/html>\n\u00a0\n \n\u8bf4\u660e\uff1a\u4e3a\u6bcf\u5f20\u56fe\u7247\u6dfb\u52a0\u4e86\u94fe\u63a5\uff0c\u53ef\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u4fee\u6539\u94fe\u63a5\u5730\u5740\u3002\n \n\u56fe\u7247\u653e\u5927\u7279\u6548\n \n&lt;!DOCTYPE html>\n&lt;html>\n\n&lt;head>\n  &lt;style>\n  .image-container {\n      width: 200px;\n      height: 200px;\n      overflow: hidden;\n    }\n\n  .image-container img {\n      width: 100%;\n      height: 100%;\n      transition: transform 0.5s;\n    }\n\n  .image-container:hover img {\n      transform: scale(1.2);\n    }\n  &lt;\/style>\n&lt;\/head>\n\n&lt;body>\n  &lt;div class=\"image-container\">\n    &lt;a href=\"https:\/\/example.com\">&lt;img src=\"image.jpg\" alt=\"\u56fe\u7247\">&lt;\/a>\n  &lt;\/div>\n&lt;\/body>\n\n&lt;\/html>\n\u00a0\n \n\u9f20\u6807\u7279\u6548\n \n\u9f20\u6807\u8ddf\u968f\u6587\u5b57\n \n&lt;!DOCTYPE html>\n&lt;html>\n\n&lt;body>\n\n  &lt;span id=\"mouse-follower\">&lt;a href=\"https:\/\/example.com\">\u8ddf\u968f\u9f20\u6807\u7684\u6587\u5b57\u94fe\u63a5&lt;\/a>&lt;\/span>\n\n  &lt;script>\n    document.addEventListener('mousemove', function (e) {\n      var follower = document.getElementById('mouse-follower');\n      follower.style.left = e.clientX + 'px';\n      follower.style.top = e.clientY + 'px';\n    });\n  &lt;\/script>\n\n&lt;\/body>\n\n&lt;\/html>\n\u00a0\n \n\u9f20\u6807\u60ac\u505c\u56fe\u7247\u5207\u6362\n \n&lt;!DOCTYPE html>\n&lt;html>\n\n&lt;head>\n  &lt;style>\n  .image-switch {\n      width: 200px;\n      height: 200px;\n    }\n\n  .image-switch img {\n      width: 100%;\n      height: 100%;\n      display: none;\n    }\n\n  .image-switch:hover img:first-child {\n      display: none;\n    }\n\n  .image-switch:hover img:last-child {\n      display: block;\n    }\n  &lt;\/style>\n&lt;\/head>\n\n&lt;body>\n  &lt;div class=\"image-switch\">\n    &lt;a href=\"https:\/\/example1.com\">&lt;img src=\"image1.jpg\" alt=\"\u56fe\u72471\">&lt;\/a>\n    &lt;a href=\"https:\/\/example2.com\">&lt;img src=\"image2.jpg\" alt=\"\u56fe\u72472\">&lt;\/a>\n  &lt;\/div>\n&lt;\/body>\n\n&lt;\/html>\n\u00a0\n \n\u80cc\u666f\u7279\u6548\n \n\u6e10\u53d8\u80cc\u666f\n \n&lt;!DOCTYPE html>\n&lt;html>\n\n&lt;head>\n  &lt;style>\n    body {\n      background: linear-gradient(to bottom right, #ff0000, #0000ff);\n    }\n  &lt;\/style>\n&lt;\/head>\n\n&lt;body>\n  &lt;a href=\"https:\/\/example.com\">\u5728\u6e10\u53d8\u80cc\u666f\u4e0a\u7684\u94fe\u63a5&lt;\/a>\n&lt;\/body>\n\n&lt;\/html>\n\u00a0\n \n\u52a8\u6001\u80cc\u666f\n \n&lt;!DOCTYPE html>\n&lt;head>\n  &lt;title>\u52a8\u6001\u80cc\u666f\u7279\u6548&lt;\/title>\n  &lt;style>\n    body {\n      background-color: #000;\n    }\n  &lt;\/style>\n&lt;\/head>\n&lt;body>\n  &lt;a href=\"https:\/\/example.com\">\u5728\u52a8\u6001\u80cc\u666f\u4e0a\u7684\u94fe\u63a5&lt;\/a>\n  &lt;script>\n    setInterval(function () {\n      document.body.style.backgroundColor = getRandomColor();\n    }, 1000);\n\n    function getRandomColor() {\n      var letters = '0123456789ABCDEF';\n      var color = '#';\n      for (var i = 0; i &lt; 6; i++) {\n        color += letters&#91;Math.floor(Math.random() * 16)];\n      }\n      return color;\n    }\n  &lt;\/script>\n&lt;\/body>\n\u00a0\n \n\u7a97\u53e3\u7279\u6548\n \n\u5f39\u51fa\u7a97\u53e3\n \n&lt;!DOCTYPE html>\n&lt;html>\n\n&lt;body>\n\n  &lt;a href=\"#\" onclick=\"javascript:window.open('https:\/\/www.example.com', 'newwindow', 'toolbar=no,scrollbars=yes,resizable=no,top=0,left=0, width=400,height=300');\">\u6253\u5f00\u65b0\u7a97\u53e3&lt;\/a>\n\n&lt;\/body>\n\n&lt;\/html>\n\u00a0\n \n\u8bf4\u660e\uff1a\u539f\u4ee3\u7801\u4e2d\u7684 \u00a0href=\"#\"\u00a0 \u662f\u4e3a\u4e86\u4f7f\u94fe\u63a5\u53ef\u70b9\u51fb\u89e6\u53d1 \u00a0onclick\u00a0 \u4e8b\u4ef6\uff0c\u8fd9\u91cc\u4fdd\u7559\u5176\u539f\u6709\u529f\u80fd\u3002\u5982\u679c\u5e0c\u671b\u94fe\u63a5\u6709\u5b9e\u9645\u8df3\u8f6c\u529f\u80fd\uff0c\u53ef\u5728\u65b0\u7a97\u53e3\u6253\u5f00\u540e\u518d\u8df3\u8f6c\u5230\u5176\u4ed6\u9875\u9762\uff0c\u4f8b\u5982\u4fee\u6539 \u00a0onclick\u00a0 \u51fd\u6570\u4e3a\uff1a\n \n&lt;a href=\"https:\/\/anotherpage.com\" onclick=\"javascript:window.open('https:\/\/www.example.com', 'newwindow', 'toolbar=no,scrollbars=yes,resizable=no,top=0,left=0, width=400,height=300'); return false;\">\u6253\u5f00\u65b0\u7a97\u53e3\u5e76\u8df3\u8f6c\u5230\u53e6\u4e00\u9875\u9762&lt;\/a>\n\u00a0\n \n\u8fd9\u91cc \u00a0return false;\u00a0 \u7528\u4e8e\u963b\u6b62\u94fe\u63a5\u9ed8\u8ba4\u7684\u8df3\u8f6c\u884c\u4e3a\uff0c\u5148\u6267\u884c\u5f39\u51fa\u65b0\u7a97\u53e3\u64cd\u4f5c\u3002\n \n\u5b9a\u65f6\u5173\u95ed\u7a97\u53e3\n \n&lt;!DOCTYPE html>\n&lt;html>\n\n&lt;head>\n  &lt;script>\n    function closeit() {\n      setTimeout(\"self.close()\", 10000)\n    }\n  &lt;\/script>\n&lt;\/head>\n\n&lt;body onload=\"closeit()\">\n\n&lt;\/body>\n\n&lt;\/html>\n\u00a0\n \n\u8bf4\u660e\uff1a\u7531\u4e8e\u6b64\u529f\u80fd\u4e3b\u8981\u662f\u5b9a\u65f6\u5173\u95ed\u5f53\u524d\u7a97\u53e3\uff0c\u00a0href\u00a0 \u5728\u6b64\u5904\u901a\u5e38\u65e0\u5b9e\u9645\u7528\u9014\u3002\u82e5\u6709\u7279\u6b8a\u9700\u6c42\uff0c\u53ef\u6dfb\u52a0\u94fe\u63a5\u5e76\u7ed3\u5408\u5176\u4ed6\u903b\u8f91\u5b9e\u73b0\u66f4\u590d\u6742\u7684\u529f\u80fd\u3002<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,15],"tags":[],"class_list":["post-490","post","type-post","status-publish","format-standard","hentry","category-12","category-15"],"_links":{"self":[{"href":"http:\/\/www.cnitw.com\/index.php?rest_route=\/wp\/v2\/posts\/490","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.cnitw.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.cnitw.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.cnitw.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.cnitw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=490"}],"version-history":[{"count":0,"href":"http:\/\/www.cnitw.com\/index.php?rest_route=\/wp\/v2\/posts\/490\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.cnitw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=490"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.cnitw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=490"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.cnitw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=490"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}