{"id":77936,"date":"2026-02-25T19:17:59","date_gmt":"2026-02-25T11:17:59","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/77936.html"},"modified":"2026-02-25T19:17:59","modified_gmt":"2026-02-25T11:17:59","slug":"js-%e8%8a%82%e7%82%b9%e6%93%8d%e4%bd%9c","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/77936.html","title":{"rendered":"JS\u2014\u8282\u70b9\u64cd\u4f5c"},"content":{"rendered":"<p id=\"main-toc\">\u76ee\u5f55<\/p>\n<p id=\"1%E3%80%81%E5%88%9B%E5%BB%BA%E6%B7%BB%E5%8A%A0%E8%8A%82%E7%82%B9-toc\" style=\"margin-left:120px\">1\u3001\u521b\u5efa\u6dfb\u52a0\u8282\u70b9<\/p>\n<p id=\"ub05703ed-toc\" style=\"margin-left:160px\">\u521b\u5efa\u8282\u70b9&#xff1a;docment.createElement(&#039;\u8282\u70b9&#039;)<\/p>\n<p id=\"u6deef9e0-toc\" style=\"margin-left:160px\">\u521b\u5efa\u6587\u672c&#xff1a;document.createTextNode(&#039;\u6587\u672c&#039;)<\/p>\n<p id=\"1%E3%80%81father.appendChild(child)-toc\" style=\"margin-left:160px\">1\u3001father.appendChild(child)<\/p>\n<p id=\"2%E3%80%81father.insertBefore(child%2C%E6%8C%87%E5%AE%9A%E5%85%83%E7%B4%A0)-toc\" style=\"margin-left:160px\">2\u3001father.insertBefore(child,\u6307\u5b9a\u5143\u7d20)<\/p>\n<p id=\"2%E3%80%81%E6%9B%BF%E6%8D%A2%E5%88%A0%E9%99%A4%E8%8A%82%E7%82%B9-toc\" style=\"margin-left:120px\">2\u3001\u66ff\u6362\u5220\u9664\u8282\u70b9<\/p>\n<p id=\"%E6%9B%BF%E6%8D%A2%E8%8A%82%E7%82%B9%EF%BC%9AreplaceChild()-toc\" style=\"margin-left:160px\">\u66ff\u6362\u8282\u70b9&#xff1a;replaceChild()<\/p>\n<p id=\"%E5%88%A0%E9%99%A4%E8%8A%82%E7%82%B9%EF%BC%9A-toc\" style=\"margin-left:160px\">\u5220\u9664\u8282\u70b9&#xff1a;<\/p>\n<p id=\"3%E3%80%81%E5%85%8B%E9%9A%86%E8%8A%82%E7%82%B9-toc\" style=\"margin-left:120px\">3\u3001\u514b\u9686\u8282\u70b9<\/p>\n<p id=\"4%E3%80%81%E5%88%9B%E5%BB%BA%E8%8A%82%E7%82%B9%E7%9A%84%E5%85%B6%E4%BB%96%E5%87%A0%E7%A7%8D%E6%96%B9%E5%BC%8F-toc\" style=\"margin-left:120px\">4\u3001\u521b\u5efa\u8282\u70b9\u7684\u5176\u4ed6\u51e0\u79cd\u65b9\u5f0f<\/p>\n<p id=\"element.innerHTML%EF%BC%9A-toc\" style=\"margin-left:160px\">element.innerHTML&#xff1a;<\/p>\n<p id=\"element.innerText-toc\" style=\"margin-left:160px\">element.innerText<\/p>\n<p id=\"document.write()-toc\" style=\"margin-left:160px\">document.write()<\/p>\n<p id=\"insertAdjacentHTML()-toc\" style=\"margin-left:160px\">insertAdjacentHTML()<\/p>\n<p id=\"5%E3%80%81%E6%B8%B2%E6%9F%93%E7%BB%93%E6%9E%84-toc\" style=\"margin-left:120px\">5\u3001\u6e32\u67d3\u7ed3\u6784<\/p>\n<hr \/>\n<h5 id=\"1%E3%80%81%E5%88%9B%E5%BB%BA%E6%B7%BB%E5%8A%A0%E8%8A%82%E7%82%B9\" style=\"background-color:transparent\">1\u3001\u521b\u5efa\u6dfb\u52a0\u8282\u70b9<\/h5>\n<h6 id=\"ub05703ed\">\u521b\u5efa\u8282\u70b9&#xff1a;docment.createElement(&#039;\u8282\u70b9&#039;)<\/h6>\n<h6 id=\"u6deef9e0\">\u521b\u5efa\u6587\u672c&#xff1a;document.createTextNode(&#039;\u6587\u672c&#039;)<\/h6>\n<p>\u6dfb\u52a0\u8282\u70b9&#xff1a;<\/p>\n<h6 id=\"1%E3%80%81father.appendChild(child)\">1\u3001father.appendChild(child)<\/h6>\n<p>\u5c06\u4e00\u4e2a\u8282\u70b9\u6dfb\u52a0\u5230\u6307\u5b9a\u7236\u8282\u70b9\u7684\u5b50\u8282\u70b9\u5217\u8868\u7684\u672b\u5c3e<\/p>\n<h6 id=\"2%E3%80%81father.insertBefore(child%2C%E6%8C%87%E5%AE%9A%E5%85%83%E7%B4%A0)\">2\u3001father.insertBefore(child,\u6307\u5b9a\u5143\u7d20)<\/h6>\n<p>\u5c06\u4e00\u4e2a\u8282\u70b9\u6dfb\u52a0\u5230\u7236\u8282\u70b9\u7684\u6307\u5b9a\u5b50\u8282\u70b9\u524d\u9762<\/p>\n<p>&lt;body&gt;<br \/>\n  &lt;!&#8211;<br \/>\n       \u9700\u6c421&#xff1a;\u5728\u6bb5\u843dp\u7684\u540e\u9762\u6dfb\u52a0\u4e00\u4e2aspan\u6807\u7b7e&#xff0c;\u6dfb\u52a0span\u7684\u6587\u672c\u5185\u5bb9\u2018\u6211\u662f\u4e00\u4e2aspan\u2019<br \/>\n       \u9700\u6c422&#xff1a;\u5728\u6bb5\u843dp\u7684\u524d\u9762\u6dfb\u52a0\u4e00\u4e2ah1\u6807\u7b7e&#xff0c;\u6dfb\u52a0h1\u7684\u6587\u672c\u5185\u5bb9&#xff0c;\u2018\u6211\u662f\u4e00\u4e2ah1\u2019<br \/>\n     &#8211;&gt;<br \/>\n  &lt;div id&#061;&#034;box&#034;&gt;<br \/>\n    &lt;!&#8211; &lt;h1&gt;\u6211\u662f\u4e00\u4e2ah1&lt;\/h1&gt; &#8211;&gt;<br \/>\n    &lt;p&gt;\u6bb5\u843d&lt;\/p&gt;<br \/>\n    &lt;!&#8211; &lt;span&gt;\u6211\u662f\u4e00\u4e2aspan&lt;\/span&gt; &#8211;&gt;<br \/>\n  &lt;\/div&gt;<br \/>\n  &lt;button&gt;\u6dfb\u52a0span&lt;\/button&gt;<br \/>\n  &lt;button&gt;\u6dfb\u52a0h1&lt;\/button&gt;<br \/>\n  &lt;script&gt;<br \/>\n    let btn &#061; document.querySelectorAll(&#034;button&#034;);<br \/>\n    let p &#061; document.querySelector(&#034;p&#034;);<br \/>\n    let box &#061; document.querySelector(&#034;#box&#034;);<br \/>\n    \/\/ \u9700\u6c42\u4e00<br \/>\n    btn[0].addEventListener(&#034;click&#034;, () &#061;&gt; {<br \/>\n      \/\/1\u3001 \u521b\u5efa\u8282\u70b9<br \/>\n      const spanEle &#061; document.createElement(&#034;span&#034;);<br \/>\n      \/\/ 2\u3001\u521b\u5efa\u6587\u672c\u8282\u70b9<br \/>\n      const text &#061; document.createTextNode(&#034;\u6211\u662fspan&#034;);<br \/>\n      \/\/ 3\u3001\u5c06\u6587\u672c\u8282\u70b9\u653e\u5230\u5143\u7d20\u8282\u70b9\u4e2d<br \/>\n      spanEle.appendChild(text);<br \/>\n      \/\/ 4\u3001\u5c06\u5143\u7d20\u8282\u70b9\u6dfb\u52a0\u5230\u6bb5\u843dp\u7684\u540e\u9762<br \/>\n      box.appendChild(spanEle);<br \/>\n    });<br \/>\n    \/\/ \u9700\u6c42\u4e8c<br \/>\n    btn[1].addEventListener(&#034;click&#034;, () &#061;&gt; {<br \/>\n      \/\/ \u91cd\u590d\u4e0a\u9762\u6b65\u9aa4<br \/>\n      const h1Ele &#061; document.createElement(&#034;h1&#034;);<br \/>\n      const text &#061; document.createTextNode(&#034;\u6211\u662fh1&#034;);<br \/>\n      h1Ele.appendChild(text);<br \/>\n      box.insertBefore(h1Ele, p);<br \/>\n    });<br \/>\n  &lt;\/script&gt;<\/p>\n<p>&lt;\/body&gt; <\/p>\n<h5 id=\"2%E3%80%81%E6%9B%BF%E6%8D%A2%E5%88%A0%E9%99%A4%E8%8A%82%E7%82%B9\">2\u3001\u66ff\u6362\u5220\u9664\u8282\u70b9<\/h5>\n<h6 id=\"%E6%9B%BF%E6%8D%A2%E8%8A%82%E7%82%B9%EF%BC%9AreplaceChild()\">\u66ff\u6362\u8282\u70b9&#xff1a;replaceChild()<\/h6>\n<p id=\"u5fe4c498\">\u53ef\u4ee5\u4f7f\u7528\u6307\u5b9a\u7684\u5b50\u8282\u70b9\u66ff\u6362\u5df2\u6709\u7684\u5b50\u8282\u70b9<\/p>\n<p id=\"u60b997a5\">\u8bed\u6cd5&#xff1a;\u7236\u8282\u70b9.replaceChild(\u65b0\u8282\u70b9&#xff0c;\u65e7\u8282\u70b9)<\/p>\n<h6 id=\"%E5%88%A0%E9%99%A4%E8%8A%82%E7%82%B9%EF%BC%9A\">\u5220\u9664\u8282\u70b9&#xff1a;<\/h6>\n<p id=\"udd0f0646\">\u5199\u6cd5\u4e00\u3001father.removeChild(child)<\/p>\n<p id=\"uc579a0e4\">\u5199\u6cd5\u4e8c\u3001child.parentNode.removeChild(child)<\/p>\n<p id=\"u1d2e04a2\">\u53ef\u4ee5\u5728DOM\u4e2d\u5220\u9664\u4e00\u4e2a\u5b50\u8282\u70b9&#xff0c;\u8fd4\u56de\u5220\u9664\u7684\u8282\u70b9<\/p>\n<p>&lt;body&gt;<br \/>\n  &lt;!&#8211; \u9700\u6c42\u4e00&#xff1a;\u70b9\u51fb\u6309\u94ae1&#xff0c;\u5c06\u300a\u91d1\u74f6\u6885\u300b\u66ff\u6362\u4e3a\u300a\u6c34\u6d52\u4f20\u300b<br \/>\n           \u9700\u6c42\u4e8c&#xff1a;\u70b9\u51fb\u6309\u94ae2&#xff0c;\u5220\u9664\u300a\u91d1\u74f6\u6885\u300b<br \/>\n    &#8211;&gt;<br \/>\n  &lt;button&gt;\u66ff\u6362&lt;\/button&gt;<br \/>\n  &lt;button&gt;\u5220\u9664&lt;\/button&gt;<br \/>\n  &lt;ul&gt;<br \/>\n    &lt;li&gt;\u300a\u7ea2\u697c\u68a6\u300b&lt;\/li&gt;<br \/>\n    &lt;li&gt;\u300a\u4e09\u56fd\u6f14\u4e49\u300b&lt;\/li&gt;<br \/>\n    &lt;li&gt;\u300a\u897f\u6e38\u8bb0\u300b&lt;\/li&gt;<br \/>\n    &lt;li&gt;\u300a\u91d1\u74f6\u6885\u300b&lt;\/li&gt;<br \/>\n  &lt;\/ul&gt;<br \/>\n  &lt;script&gt;<br \/>\n    \/\/ \u9700\u6c42\u4e00<br \/>\n    let btn &#061; document.querySelectorAll(&#034;button&#034;);<br \/>\n    let ulEle &#061; document.querySelector(&#034;ul&#034;);<br \/>\n    \/\/ let jpm &#061; ulEle.children[3]; \/\/\u653e\u5728\u91cc\u9762\u4e0d\u7136\u4e00\u4f1a\u66ff\u6362\u4e86\u5c31\u627e\u4e0d\u5230\u8fd9\u4e2a\u5143\u7d20\u4e86<br \/>\n    btn[0].addEventListener(&#034;click&#034;, () &#061;&gt; {<br \/>\n      let jpm &#061; ulEle.children[3];<br \/>\n      const liEle &#061; document.createElement(&#034;li&#034;);<br \/>\n      const text &#061; document.createTextNode(&#034;\u6c34\u6d52\u4f20&#034;);<br \/>\n      liEle.appendChild(text);<br \/>\n      ulEle.replaceChild(liEle, jpm);<br \/>\n    });<br \/>\n    \/\/ \u9700\u6c42\u4e8c<br \/>\n    btn[1].addEventListener(&#034;click&#034;, () &#061;&gt; {<br \/>\n      let jpm &#061; ulEle.children[3];<br \/>\n      \/\/ \u5220\u9664\u8282\u70b9&#xff0c;\u65b9\u5f0f\u4e00<br \/>\n      \/\/ ulEle.removeChild(jpm);<br \/>\n      \/\/ \u5220\u9664\u8282\u70b9&#xff0c;\u65b9\u5f0f\u4e8c,\u8fd9\u79cd\u65b9\u5f0f\u662f\u901a\u8fc7parentNode\u7531\u5b50\u5143\u7d20\u627e\u7236\u5143\u7d20&#xff0c;\u518d\u5220\u9664\u6307\u5b9a\u5b50\u5143\u7d20<br \/>\n      jpm.parentNode.removeChild(jpm);<br \/>\n    });<\/p>\n<p>  &lt;\/script&gt;<br \/>\n&lt;\/body&gt; <\/p>\n<h5 id=\"3%E3%80%81%E5%85%8B%E9%9A%86%E8%8A%82%E7%82%B9\" style=\"background-color:transparent\">3\u3001\u514b\u9686\u8282\u70b9<\/h5>\n<p id=\"ue4379a85\">node.cloneNode()<\/p>\n<p>\u8fd4\u56de\u8c03\u7528\u8be5\u65b9\u6cd5\u7684\u8282\u70b9\u7684\u4e00\u4e2a\u526f\u672c<\/p>\n<p id=\"u904ed034\">\u53c2\u6570&#xff1a;\u5e03\u5c14\u503c,\u9ed8\u8ba4\u662ffalse<\/p>\n<p id=\"u1a33dc2b\">false \u53ea\u514b\u9686\u8282\u70b9\u672c\u8eab&#xff0c;\u4e0d\u514b\u9686\u91cc\u9762\u7684\u5b50\u8282\u70b9<\/p>\n<p id=\"u2e964cab\">true \u62f7\u8d1d\u8282\u70b9&#xff0c;\u62f7\u8d1d\u5185\u5bb9<\/p>\n<p>&lt;body&gt;<br \/>\n  &lt;!&#8211; \u9700\u6c42:\u70b9\u51fb\u6309\u94ae\u514b\u9686div\u5143\u7d20&#8211;&gt;<br \/>\n  &lt;div id&#061;&#034;box&#034;&gt;box\u76d2\u5b50&lt;\/div&gt;<br \/>\n  &lt;button&gt;\u514b\u9686&lt;\/button&gt;<br \/>\n  &lt;script&gt;<br \/>\n    let but &#061; document.querySelector(&#034;button&#034;);<br \/>\n    let box &#061; document.querySelector(&#034;#box&#034;);<br \/>\n    but.addEventListener(&#034;click&#034;, () &#061;&gt; {<br \/>\n      const box1 &#061; box.cloneNode(true);\/\/\u9ed8\u8ba4\u662ffalse&#xff0c;\u53ea\u514b\u9686\u672c\u8eab<br \/>\n      \/\/ document.body.appendChild(box1);<br \/>\n      document.body.insertBefore(box1, box);<br \/>\n    });<br \/>\n  &lt;\/script&gt;<\/p>\n<p>&lt;\/body&gt; <\/p>\n<h5 id=\"4%E3%80%81%E5%88%9B%E5%BB%BA%E8%8A%82%E7%82%B9%E7%9A%84%E5%85%B6%E4%BB%96%E5%87%A0%E7%A7%8D%E6%96%B9%E5%BC%8F\" style=\"background-color:transparent\">4\u3001\u521b\u5efa\u8282\u70b9\u7684\u5176\u4ed6\u51e0\u79cd\u65b9\u5f0f<\/h5>\n<p>\u5373\u4e00\u4e9b\u66f4\u7b80\u4fbf\u7684\u5199\u6cd5\u65b9\u5f0f<\/p>\n<h6 id=\"element.innerHTML%EF%BC%9A\">element.innerHTML&#xff1a;<\/h6>\n<p>\u5141\u8bb8\u66f4\u6539html\u5143\u7d20\u7684\u5185\u5bb9,\u53ef\u4ee5\u8bbe\u7f6e\u6216\u8fd4\u56de\u8868\u683c\u884c\u7684\u5f00\u59cb\u548c\u7ed3\u675f\u6807\u7b7e\u4e4b\u95f4\u7684HTML&#xff0c;\u53ef\u4ee5\u89e3\u6790html\u6807\u7b7e<\/p>\n<h6 id=\"element.innerText\">element.innerText<\/h6>\n<p id=\"u677abe92\">\u83b7\u53d6\u6216\u8bbe\u7f6e\u5143\u7d20\u7684\u6587\u672c&#8212;-\u4ee5\u7eaf\u6587\u672c\u7684\u65b9\u5f0f\u76f4\u63a5\u663e\u793a&#xff0c;\u4e0d\u53ef\u4ee5\u89e3\u6790html\u6807\u7b7e<\/p>\n<h6 id=\"document.write()\">document.write()<\/h6>\n<p id=\"uc11240e1\">\u76f4\u63a5\u5c06\u5185\u5bb9\u5199\u5165\u9875\u9762\u7684\u5185\u5bb9\u6d41&#xff0c;\u4f46\u662f\u6587\u6863\u6267\u884c\u5b8c\u6bd5&#xff0c;\u5219\u4f1a\u5bfc\u81f4\u9875\u9762\u5168\u90e8\u91cd\u7ed8<\/p>\n<h6 id=\"insertAdjacentHTML()\">insertAdjacentHTML()<\/h6>\n<p id=\"u9aa10e88\">insertAdjacentHTML() \u662fElement\u7684API\u4e2d\u7684\u4e00\u4e2a\u65b9\u6cd5&#xff0c;\u53ef\u4ee5\u5c06\u5b57\u7b26\u4e32\u6587\u672c\u8f6c\u5316\u4e3a\u4f60\u60f3\u8981\u7684\u8282\u70b9&#xff08;Node&#xff09;&#xff0c;\u5e76\u4e14\u63d2\u5165\u5230\u4f60\u60f3\u8981\u63d2\u5165\u7684\u4f4d\u7f6e\u4e2d\u3002\u800c\u4e14\u5b83\u5e76\u4e0d\u4f1a\u5411innerHTML\u4e00\u6837\u4f1a\u66ff\u6362\u6389\u5df2\u6709\u7684\u8282\u70b9&#xff0c;\u800c\u662f\u4f1a\u63d2\u5165\u5230\u6307\u5b9a\u4f4d\u7f6e\u3002<\/p>\n<p id=\"ue2a2875f\">\u8bed\u6cd5&#xff1a;element.insertAdjacentHTML(position,text)<\/p>\n<p>\u53c2\u6570position\u7684\u53ef\u9009\u503c&#xff1a;beforebegin\u3001afterbegin\u3001beforeend\u3001afterend&#xff0c;\u5bf9\u5e94\u4f4d\u7f6e\u5982\u4e0b\u56fe<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"291\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260225111758-699eda6684be1.png\" width=\"200\" \/><\/p>\n<p>&lt;body&gt;<br \/>\n  &lt;!&#8211;<br \/>\n    \u9700\u6c42:\u5728ul\u91cc\u6dfb\u52a0\u300a\u6c34\u6d52\u4f20\u300b\u5230\u9875\u9762\u4e2d<br \/>\n         innerHTML\u3001document.write()<br \/>\n    &#8211;&gt;<br \/>\n  &lt;button&gt;\u6dfb\u52a0&lt;\/button&gt;<br \/>\n  &lt;ul&gt;<br \/>\n    &lt;li&gt;\u300a\u7ea2\u697c\u68a6\u300b&lt;\/li&gt;<br \/>\n    &lt;!&#8211; &lt;li&gt;\u300a\u6c34\u6d52\u4f20\u300b&lt;\/li&gt; &#8211;&gt;<br \/>\n  &lt;\/ul&gt;<br \/>\n  &lt;script&gt;<br \/>\n    let ul &#061; document.querySelector(&#034;ul&#034;);<br \/>\n    let bot &#061; document.querySelector(&#034;button&#034;);<br \/>\n    bot.addEventListener(&#034;click&#034;, () &#061;&gt; {<br \/>\n      \/\/ \u5199\u6cd5\u4e00<br \/>\n      const liEle &#061; document.createElement(&#034;li&#034;);<br \/>\n      const text &#061; document.createTextNode(&#034;\u300a\u6c34\u6d52\u4f20\u300b&#034;);<br \/>\n      liEle.appendChild(text);<br \/>\n      ul.appendChild(liEle);<\/p>\n<p>      \/\/ \u5199\u6cd5\u4e8c<br \/>\n      const liEle &#061; document.querySelector(&#034;li&#034;);<br \/>\n      \/\/ liEle.innerText &#061; &#034;\u300a\u6c34\u6d52\u4f20\u300b&#034;;\/\/\u8fd9\u79cd\u5199\u6cd5\u76f8\u5f53\u4e8e\u91cd\u65b0\u8d4b\u503c&#xff0c;\u539f\u503c\u88ab\u8986\u76d6\u4e86<br \/>\n      liEle.innerHTML &#061; &#034;\u300a\u6c34\u6d52\u4f20\u300b&#034;\/\/\u8fd9\u4e2a\u4e5f\u662f\u7684<br \/>\n      ul.appendChild(liEle)<\/p>\n<p>      \/\/ \u5199\u6cd5\u4e09<br \/>\n      \/\/ \u91cd\u7ed8&#xff0c;\u57fa\u4e8e\u5199\u6cd5\u4e8c&#xff0c;\u53ef\u4ee5\u5b9e\u73b0\u6548\u679c&#xff0c;\u4f46\u5f71\u54cd\u6548\u7387<br \/>\n      ul.innerHTML &#061; &#034;&lt;li&gt;\u300a\u7ea2\u697c\u68a6\u300b&lt;\/li&gt;&lt;li&gt;\u300a\u6c34\u6d52\u4f20\u300b&lt;\/li&gt;&#034;;<br \/>\n      \/\/\u8fd8\u6709\u4e0b\u9762\u8fd9\u6837\u7684&#xff08;\u4e0d\u5982\u4e0a\u9762\u7684&#xff09;<br \/>\n      \/\/ document.write(<br \/>\n      \/\/   &#034; &lt;button&gt;\u6dfb\u52a0&lt;\/button&gt;&lt;ul&gt;&lt;li&gt;\u300a\u7ea2\u697c\u68a6\u300b&lt;\/li&gt;&lt;li&gt;\u300a\u6c34\u6d52\u4f20\u300b&lt;\/li&gt;&lt;\/ul&gt;&#034;,<br \/>\n      \/\/ );<\/p>\n<p>      \/\/ \u5199\u6cd5\u56db father.insertAdjacentHTML(\u4f4d\u7f6e,\u8282\u70b9\u5b57\u7b26\u4e32)<br \/>\n      let li &#061; &#096;&lt;li&gt;\u300a\u6c34\u6d52\u4f20\u300b&lt;\/li&gt;&#096;;<br \/>\n      ul.insertAdjacentHTML(&#034;beforeend&#034;, li);<br \/>\n    });<\/p>\n<p>  &lt;\/script&gt;<br \/>\n&lt;\/body&gt; <\/p>\n<h5 id=\"5%E3%80%81%E6%B8%B2%E6%9F%93%E7%BB%93%E6%9E%84\" style=\"background-color:transparent\">5\u3001\u6e32\u67d3\u7ed3\u6784<\/h5>\n<p>\u4e00\u822c\u5b9a\u4e49\u7c7b\u6765\u5199<\/p>\n<p>&lt;body&gt;<br \/>\n  &lt;ul&gt;<br \/>\n    &lt;!&#8211;<br \/>\n        &lt;li&gt;\u9996\u9875&lt;\/li&gt;<br \/>\n      &lt;li&gt;\u5206\u7c7b&lt;\/li&gt;<br \/>\n      &lt;li&gt;\u53d1\u73b0&lt;\/li&gt;<br \/>\n      &lt;li&gt;\u6211\u7684&lt;\/li&gt; &#8211;&gt;<br \/>\n  &lt;\/ul&gt;<br \/>\n  &lt;script&gt;<\/p>\n<p>    class Footernav {<br \/>\n      \/\/\u9759\u6001\u6570\u636e<br \/>\n      ulele &#061; document.querySelector(&#034;ul&#034;);<br \/>\n      footernav &#061; [<br \/>\n        { iconClass: &#034;iconfont icon-shouye&#034;, text: &#034;\u9996\u9875&#034;, active: false },<br \/>\n        { iconClass: &#034;iconfont icon-fenlei&#034;, text: &#034;\u5206\u7c7b&#034;, active: false },<br \/>\n        { iconClass: &#034;iconfont icon-find&#034;, text: &#034;\u53d1\u73b0&#034;, active: false },<br \/>\n        {iconClass: &#034;iconfont icon-gouwuchekong&#034;,text: &#034;\u8d2d\u7269\u8f66&#034;,active: false},<br \/>\n        { iconClass: &#034;iconfont icon-wode&#034;, text: &#034;\u6211\u7684&#034;, active: true },<br \/>\n      ];<br \/>\n      constructor() { \/\/\u5e95\u5c42\u6784\u9020\u51fd\u6570,\u4e00\u65e6\u7c7b\u6267\u884c\u4e86,\u5c31\u4f1a\u7b2c\u4e00\u65f6\u95f4\u81ea\u5df1\u8c03\u7528<br \/>\n        this.gender();<br \/>\n      };<br \/>\n      \/\/ \u6e32\u67d3\u51fd\u6570<br \/>\n      gender() {<br \/>\n        let str &#061; &#034;&#034;;<br \/>\n        this.footernav.map((item) &#061;&gt; {<br \/>\n          str &#043;&#061; &#096;&lt;li&gt;${item.text}&lt;\/li&gt;&#096;<br \/>\n        });<br \/>\n        this.ulele.innerHTML &#061; str;<br \/>\n      };<br \/>\n    };<br \/>\n    const f &#061; new Footernav();<\/p>\n<p>  &lt;\/script&gt;<br \/>\n&lt;\/body&gt;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u5f55<br \/>\n1\u3001\u521b\u5efa\u6dfb\u52a0\u8282\u70b9<br \/>\n\u521b\u5efa\u8282\u70b9&#xff1a;docment.createElement(\u8282\u70b9)<br \/>\n\u521b\u5efa\u6587\u672c&#xff1a;document.createTextNode(\u6587\u672c)<br \/>\n1\u3001father.appendChild(child)<br \/>\n2\u3001father.insertBefore(child,\u6307\u5b9a\u5143\u7d20)<br \/>\n2\u3001\u66ff\u6362\u5220\u9664\u8282\u70b9<br \/>\n\u66ff\u6362\u8282\u70b9&#xff1a;replaceChild()<br \/>\n\u5220\u9664\u8282\u70b9&#xff1a;<br \/>\n3\u3001\u514b\u9686\u8282\u70b9<br \/>\n4\u3001\u521b\u5efa\u8282\u70b9\u7684\u5176\u4ed6\u51e0\u79cd\u65b9\u5f0f<br \/>\nelement<\/p>\n","protected":false},"author":2,"featured_media":77935,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[187,87,190],"topic":[],"class_list":["post-77936","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-javascript","tag-87","tag-190"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>JS\u2014\u8282\u70b9\u64cd\u4f5c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/77936.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JS\u2014\u8282\u70b9\u64cd\u4f5c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u76ee\u5f55 1\u3001\u521b\u5efa\u6dfb\u52a0\u8282\u70b9 \u521b\u5efa\u8282\u70b9&#xff1a;docment.createElement(\u8282\u70b9) \u521b\u5efa\u6587\u672c&#xff1a;document.createTextNode(\u6587\u672c) 1\u3001father.appendChild(child) 2\u3001father.insertBefore(child,\u6307\u5b9a\u5143\u7d20) 2\u3001\u66ff\u6362\u5220\u9664\u8282\u70b9 \u66ff\u6362\u8282\u70b9&#xff1a;replaceChild() \u5220\u9664\u8282\u70b9&#xff1a; 3\u3001\u514b\u9686\u8282\u70b9 4\u3001\u521b\u5efa\u8282\u70b9\u7684\u5176\u4ed6\u51e0\u79cd\u65b9\u5f0f element\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/77936.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-25T11:17:59+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260225111758-699eda6684be1.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/77936.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/77936.html\",\"name\":\"JS\u2014\u8282\u70b9\u64cd\u4f5c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-25T11:17:59+00:00\",\"dateModified\":\"2026-02-25T11:17:59+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/77936.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/77936.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/77936.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JS\u2014\u8282\u70b9\u64cd\u4f5c\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JS\u2014\u8282\u70b9\u64cd\u4f5c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/77936.html","og_locale":"zh_CN","og_type":"article","og_title":"JS\u2014\u8282\u70b9\u64cd\u4f5c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u76ee\u5f55 1\u3001\u521b\u5efa\u6dfb\u52a0\u8282\u70b9 \u521b\u5efa\u8282\u70b9&#xff1a;docment.createElement(\u8282\u70b9) \u521b\u5efa\u6587\u672c&#xff1a;document.createTextNode(\u6587\u672c) 1\u3001father.appendChild(child) 2\u3001father.insertBefore(child,\u6307\u5b9a\u5143\u7d20) 2\u3001\u66ff\u6362\u5220\u9664\u8282\u70b9 \u66ff\u6362\u8282\u70b9&#xff1a;replaceChild() \u5220\u9664\u8282\u70b9&#xff1a; 3\u3001\u514b\u9686\u8282\u70b9 4\u3001\u521b\u5efa\u8282\u70b9\u7684\u5176\u4ed6\u51e0\u79cd\u65b9\u5f0f element","og_url":"https:\/\/www.wsisp.com\/helps\/77936.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-25T11:17:59+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260225111758-699eda6684be1.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/77936.html","url":"https:\/\/www.wsisp.com\/helps\/77936.html","name":"JS\u2014\u8282\u70b9\u64cd\u4f5c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-25T11:17:59+00:00","dateModified":"2026-02-25T11:17:59+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/77936.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/77936.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/77936.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"JS\u2014\u8282\u70b9\u64cd\u4f5c"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/77936","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=77936"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/77936\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/77935"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=77936"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=77936"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=77936"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=77936"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}