{"id":4762,"date":"2022-03-27T20:45:50","date_gmt":"2022-03-27T12:45:50","guid":{"rendered":"https:\/\/egonlin.com\/?p=4762"},"modified":"2022-03-27T20:50:38","modified_gmt":"2022-03-27T12:50:38","slug":"%e7%ac%ac%e4%ba%8c%e8%8a%82%ef%bc%9a%e6%96%87%e6%a1%a3%e5%af%b9%e8%b1%a1%e6%a8%a1%e5%9e%8b","status":"publish","type":"post","link":"https:\/\/egonlin.com\/?p=4762","title":{"rendered":"\u7b2c\u4e8c\u8282\uff1a\u6587\u6863\u5bf9\u8c61\u6a21\u578b"},"content":{"rendered":"<h1>\u6587\u6863\u5bf9\u8c61\u6a21\u578b DOM<\/h1>\n<h2>1\u3001DOM\u6982\u8ff0<\/h2>\n<h3>1-1 \u4ec0\u4e48\u662fDOM<\/h3>\n<ul>\n<li>\u6587\u6863\u5bf9\u8c61\u6a21\u578b Document Object Model<\/li>\n<li>\u6587\u6863\u5bf9\u8c61\u6a21\u578b \u662f\u8868\u793a\u548c\u64cd\u4f5c HTML\u548cXML\u6587\u6863\u5185\u5bb9\u7684\u57fa\u7840API<\/li>\n<li>\u6587\u6863\u5bf9\u8c61\u6a21\u578b\uff0c\u662fW3C\u7ec4\u7ec7\u63a8\u8350\u7684\u5904\u7406\u53ef\u6269\u5c55\u6807\u5fd7\u8bed\u8a00\u7684\u6807\u51c6\u7f16\u7a0b\u63a5\u53e3<\/li>\n<\/ul>\n<h3>12 DOM\u5206\u7c7b<\/h3>\n<ul>\n<li>\u6838\u5fc3 DOM &#8211; \u9488\u5bf9\u4efb\u4f55\u7ed3\u6784\u5316\u6587\u6863\u7684\u6807\u51c6\u6a21\u578b<\/li>\n<li>XML DOM &#8211; \u9488\u5bf9 XML \u6587\u6863\u7684\u6807\u51c6\u6a21\u578b<\/li>\n<li>HTML DOM &#8211; \u9488\u5bf9 HTML \u6587\u6863\u7684\u6807\u51c6\u6a21\u578b<\/li>\n<\/ul>\n<h3>1-3 DOM\u5206\u7ea7<\/h3>\n<ul>\n<li>\n<p>1\u7ea7dom<\/p>\n<pre><code>1\u7ea7DOM\u57281998\u5e7410\u6708\u4efd\u6210\u4e3aW3C\u7684\u63d0\u8bae\uff0c\u7531DOM\u6838\u5fc3\u4e0eDOM HTML\u4e24\u4e2a\u6a21\u5757\u7ec4\u6210\u3002DOM\u6838\u5fc3\u80fd\u6620\u5c04\u4ee5XML\u4e3a\u57fa\u7840\u7684\u6587\u6863\u7ed3\u6784\uff0c\u5141\u8bb8\u83b7\u53d6\u548c\u64cd\u4f5c\u6587\u6863\u7684\u4efb\u610f\u90e8\u5206\u3002DOM HTML\u901a\u8fc7\u6dfb\u52a0HTML\u4e13\u7528\u7684\u5bf9\u8c61\u4e0e\u51fd\u6570\u5bf9DOM\u6838\u5fc3\u8fdb\u884c\u4e86\u6269\u5c55\u3002<\/code><\/pre>\n<\/li>\n<li>\n<p>2\u7ea7dom<\/p>\n<pre><code>\u901a\u8fc7\u5bf9\u539f\u6709DOM\u7684\u6269\u5c55\uff0c2\u7ea7DOM\u901a\u8fc7\u5bf9\u8c61\u63a5\u53e3\u589e\u52a0\u4e86\u5bf9\u9f20\u6807\u548c\u7528\u6237\u754c\u9762\u4e8b\u4ef6\u3001\u8303\u56f4\u3001\u904d\u5386\uff08\u91cd\u590d\u6267\u884cDOM\u6587\u6863\uff09\u548c\u5c42\u53e0\u6837\u5f0f\u8868\uff08CSS\uff09\u7684\u652f\u6301\u3002<\/code><\/pre>\n<\/li>\n<li>\n<p>3\u7ea7dom<\/p>\n<pre><code>3\u7ea7DOM\u901a\u8fc7\u5f15\u5165\u7edf\u4e00\u65b9\u5f0f\u8f7d\u5165\u548c\u4fdd\u5b58\u6587\u6863\u548c\u6587\u6863\u9a8c\u8bc1\u65b9\u6cd5\u5bf9DOM\u8fdb\u884c\u8fdb\u4e00\u6b65\u6269\u5c55\uff0cDOM3\u5305\u542b\u4e00\u4e2a\u540d\u4e3a\u201cDOM\u8f7d\u5165\u4e0e\u4fdd\u5b58\u201d\u7684\u65b0\u6a21\u5757\uff0cDOM\u6838\u5fc3\u6269\u5c55\u540e\u53ef\u652f\u6301XML1.0\u7684\u6240\u6709\u5185\u5bb9\uff0c\u5305\u62ecXML Infoset\u3001 XPath\u3001\u548cXML Base\u3002<\/code><\/pre>\n<\/li>\n<\/ul>\n<h3>1-4 DOM\u6811<\/h3>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/\u6587\u6863\u5bf9\u8c61\u6a21\u578b1.gif'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/03\/\u6587\u6863\u5bf9\u8c61\u6a21\u578b1.gif\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<h2>2\u3001\u8282\u70b9<\/h2>\n<h3>2-1 \u4ec0\u4e48\u662f\u8282\u70b9<\/h3>\n<p>\u6587\u6863\u4e2d\u7684\u6bcf\u4e00\u4e2a\u90e8\u5206\u90fd\u662f\u8282\u70b9,\u5305\u62ecdocument \u5143\u7d20\u00a0 \u5c5e\u6027 \u6587\u672c&#8230; <\/p>\n<h3>2-2 \u8282\u70b9\u7684\u5206\u7c7b<\/h3>\n<ul>\n<li>Document<br \/>\nElement    \u5143\u7d20<br \/>\nAttr      \u5c5e\u6027<\/li>\n<li>Text          \u6587\u672c<\/li>\n<li>Comment  \u6ce8\u91ca<\/li>\n<\/ul>\n<h3>23 \u8282\u70b9\u5c5e\u6027<\/h3>\n<ul>\n<li>\n<p>nodeName  \u8282\u70b9\u540d\u5b57<\/p>\n<pre><code>document :  #document\nelement : \u6807\u7b7e\u540d\nattr : \u5c5e\u6027\u540d\ntext : #text\ncomment : #comment<\/code><\/pre>\n<\/li>\n<li>\n<p>nodeValue  \u8282\u70b9\u503c<\/p>\n<pre><code>document : null\nelement : null\nattr : \u5c5e\u6027\u503c\ntext : \u6587\u672c\u5185\u5bb9\ncomment : \u6ce8\u91ca\u5185\u5bb9<\/code><\/pre>\n<\/li>\n<li>\n<p>nodeType \u8282\u70b9\u7c7b\u578b<\/p>\n<pre><code>document : 9\nelement : 1\nattr : 2\ntext : 3\ncoment : 8<\/code><\/pre>\n<\/li>\n<\/ul>\n<h2>3\u3001\u83b7\u53d6\u5143\u7d20\u5bf9\u8c61<\/h2>\n<ul>\n<li>\n<p>\u901a\u8fc7ID\u83b7\u53d6\u5143\u7d20<\/p>\n<pre><code>document.getElementById()\nid\u5c5e\u6027\u53ef\u81ea\u52a8\u6210\u4e3a\u88ab\u811a\u672c\u8bbf\u95ee\u7684\u5168\u5c40\u53d8\u91cf<\/code><\/pre>\n<\/li>\n<li>\n<p>\u901a\u8fc7name\u503c\u83b7\u53d6\u5143\u7d20<\/p>\n<pre><code>document.getElementsByName()\nIE9+\u548c\u6807\u51c6\u6d4f\u89c8\u5668\u8ba4\u4e3a \u6240\u6709\u7684\u5143\u7d20\u90fd\u6709name\nIE9- \u8ba4\u4e3a\u53ea\u6709\u4e2a\u522b\u5143\u7d20\u6709name\n    \u8868\u5355\u548c\u8868\u5355\u63a7\u4ef6\n    img iframe  embed object ....\n\ndocuemnt\u4f1a\u4e3a\u67d0\u4e9b\u5143\u7d20\u521b\u5efa\u4ee5\u5143\u7d20name\u4e3a\u540d\u5b57\u7684\u5c5e\u6027\n<form>\n<img>\n.......<\/code><\/pre>\n<\/li>\n<li>\n<p>\u901a\u8fc7\u6807\u7b7e\u540d\u83b7\u53d6\u5143\u7d20<\/p>\n<pre><code>document.getElementsByTagName()\nelement.getElementsByTagName()\ndocument.images   \u6240\u6709img\u7684\u5f15\u7528\ndocument.forms    \u6240\u6709\u8868\u5355\u7684\u5f15\u7528\ndocument.links    \u6240\u6709\u8d85\u94fe\u63a5\u7684\u5f15\u7528\ndocuent.anchors   \u6240\u6709\u951a\u70b9\u7684\u5f15\u7528\n<\/code><\/pre>\n<\/li>\n<li>\n<p>\u901a\u8fc7\u7c7b\u540d\u9009\u53d6\u5143\u7d20(IE9+)<\/p>\n<pre><code>document.getElementsByClassName()\nelement.getElementsByClassName()\n<\/code><\/pre>\n<\/li>\n<li>\n<p>\u901a\u8fc7CSS\u9009\u62e9\u5668\u9009\u53d6\u5143\u7d20<\/p>\n<pre><code>document.querySelectorAll()\ndocument.querySelector()\nelement.querySelectorAll()\nelement.querySelector()\n<\/code><\/pre>\n<\/li>\n<li>\n<p>\u83b7\u53d6\u6240\u6709\u7684\u5143\u7d20<\/p>\n<pre><code>document.all\n<\/code><\/pre>\n<\/li>\n<\/ul>\n<h2>4\u3001\u6587\u6863\u7ed3\u6784\u548c\u904d\u5386\u6587\u6863<\/h2>\n<h3>4-1 \u8282\u70b9\u5173\u7cfb<\/h3>\n<ul>\n<li>\u7236\u8282\u70b9 \u7236\u5143\u7d20<\/li>\n<li>\u5b50\u8282\u70b9 \u5b50\u5143\u7d20<\/li>\n<li>\u540c\u8f88\u8282\u70b9 \u540c\u8f88\u5143\u7d20<\/li>\n<li>\u7956\u5148\u8282\u70b9 \u7956\u5148\u5143\u7d20<\/li>\n<li>\u540e\u4ee3\u8282\u70b9 \u540e\u4ee3\u5143\u7d20<\/li>\n<\/ul>\n<h3>4-2 \u4f5c\u4e3a\u8282\u70b9\u6811\u7684\u6587\u6863<\/h3>\n<ul>\n<li>parentNode    \u7236\u8282\u70b9<\/li>\n<li>childNodes    \u6240\u6709\u5b50\u8282\u70b9\u7684\u96c6\u5408<\/li>\n<li>firstChild    \u7b2c\u4e00\u4e2a\u5b50\u8282\u70b9<\/li>\n<li>lastChild     \u6700\u540e\u4e00\u4e2a\u5b50\u8282\u70b9<\/li>\n<li>nextSibling   \u4e0b\u4e00\u4e2a\u5144\u5f1f\u8282\u70b9<\/li>\n<li>previousSibling   \u4e0a\u4e00\u4e2a\u5144\u5f1f\u8282\u70b9<\/li>\n<\/ul>\n<h3>4-3 \u4f5c\u4e3a\u5143\u7d20\u6811\u7684\u6587\u6863<\/h3>\n<ul>\n<li>parentElement \u7236\u5143\u7d20 \u5927\u90e8\u5206\u60c5\u51b5\u4e0b parentElement \u7b49\u540c\u4e8e parentNode<\/li>\n<li>children  \u6240\u6709\u5b50\u5143\u7d20\u7684\u96c6\u5408<\/li>\n<li>firstElementChild     IE9+    \u7b2c\u4e00\u4e2a\u5b50\u5143\u7d20<\/li>\n<li>lastElementChild          IE9+        \u6700\u540e\u4e00\u4e2a\u5b50\u5143\u7d20<\/li>\n<li>nextElementSibling    IE9+    \u4e0b\u4e00\u4e2a\u5144\u5f1f\u5143\u7d20<\/li>\n<li>previousElementSibling    IE9+    \u4e0a\u4e00\u4e2a\u5144\u5f1f\u5143\u7d20<\/li>\n<li>childElementCount IE9+    \u5b50\u5143\u7d20\u7684\u6570\u91cf<\/li>\n<li>ownerDocument     \u8fd4\u56de\u5143\u7d20\u6240\u5c5e\u7684\u6587\u6863\u5bf9\u8c61<\/li>\n<\/ul>\n<h2>5\u3001\u5c5e\u6027<\/h2>\n<h3>5-1 HTML\u6807\u7b7e\u7684\u5c5e\u6027\u548c\u5143\u7d20\u5bf9\u8c61\u7684\u5c5e\u6027<\/h3>\n<p>HTMLElement\u5bf9\u8c61\u6620\u5c04\u4e86\u5143\u7d20\u7684HTML\u5c5e\u6027<\/p>\n<h3>5-2 \u83b7\u53d6\u548c\u8bbe\u7f6e\u975e\u6807\u51c6\u7684HTML\u5c5e\u6027<\/h3>\n<ul>\n<li>getAttribute(attrname)    \u83b7\u53d6\u81ea\u5b9a\u4e49\u6216\u5185\u7f6e\u5c5e\u6027\u7684\u503c<\/li>\n<li>setAttribute(attrnane, value) \u8bbe\u7f6e\u81ea\u5b9a\u4e49\u6216\u5185\u7f6e\u5c5e\u6027<\/li>\n<li>hasAttribute(attrname)    \u5224\u65ad\u662f\u5426\u5b58\u5728\u8be5\u5c5e\u6027<\/li>\n<li>removeAttribute() \u79fb\u51fa\u81ea\u5b9a\u4e49\u6216\u5185\u7f6e\u7684\u5c5e\u6027<\/li>\n<\/ul>\n<h3>5-3 \u4f5c\u4e3aAttr\u8282\u70b9\u7684<\/h3>\n<ul>\n<li>arrtibutes \u5c5e\u6027<\/li>\n<li>setAttributeNode()<\/li>\n<li>getAttributeNode()<\/li>\n<li>document.createAttribute()    \u521b\u5efa\u5c5e\u6027\u8282\u70b9<\/li>\n<\/ul>\n<h2>6\u3001\u5143\u7d20\u7684\u5185\u5bb9<\/h2>\n<h3>6-1 \u4f5c\u4e3aHTML\u7684\u5143\u7d20\u5185\u5bb9<\/h3>\n<ul>\n<li>innerHTML<\/li>\n<li>outerHTML<\/li>\n<\/ul>\n<h3>6-2 \u4f5c\u4e3a\u7eaf\u6587\u672c\u7684\u5143\u7d20\u5185\u5bb9<\/h3>\n<ul>\n<li>textContent   IE9+<\/li>\n<li>innerText    \u4f1a\u5ffd\u7565\u591a\u4f59\u7a7a\u767d<\/li>\n<\/ul>\n<h3>6-3 \u4f5c\u4e3aText\u8282\u70b9\u7684\u5143\u7d20\u5185\u5bb9<\/h3>\n<h4>\u6587\u672c\u8282\u70b9\u7684\u65b9\u6cd5<\/h4>\n<pre><code>appendData()    \u5411\u6587\u672c\u8282\u70b9\u8ffd\u52a0\u5185\u5bb9\ndeleteData()    \u5220\u9664\u6587\u672c\u8282\u70b9\u7684\u4e00\u90e8\u5206\u5185\u5bb9\ninsertData()    \u5411\u6587\u672c\u8282\u70b9\u4e2d\u63d2\u5165\u5185\u5bb9\nreplaceData()   \u66ff\u6362\u5185\u5bb9\nsubstringData() \u622a\u53d6\u5185\u5bb9\n<\/code><\/pre>\n<h4>\u521b\u5efa\u6587\u672c\u8282\u70b9<\/h4>\n<pre><code>document.createTextNode()\n<\/code><\/pre>\n<h2>7\u3001\u521b\u5efa\u3001\u63d2\u5165\u3001\u5220\u9664 \u8282\u70b9<\/h2>\n<h3>7-1 \u521b\u5efa\u8282\u70b9<\/h3>\n<pre><code>document.createElement()\n<\/code><\/pre>\n<h3>7-2 \u63d2\u5165\u8282\u70b9<\/h3>\n<pre><code>appendChild()   \u5728\u5143\u7d20\u7684\u6700\u540e\u8ffd\u52a0\u4e00\u4e2a\u5b50\u5143\u7d20\ninsertBefore()  \u5728\u5143\u7d20\u6307\u5b9a\u7684\u4f4d\u7f6e\u63d2\u5165\u4e00\u4e2a\u5b50\u5143\u7d20\n<\/code><\/pre>\n<h3>7-3 \u5220\u9664\u8282\u70b9<\/h3>\n<pre><code>removeChild()\n<\/code><\/pre>\n<h3>7-4 \u66ff\u6362\u8282\u70b9<\/h3>\n<pre><code>replaceChild(new_node, old_node)\n<\/code><\/pre>\n<h3>7-5 \u514b\u9686\u8282\u70b9<\/h3>\n<pre><code>cloneNode()\n    \u53c2\u6570\n    true    \u514b\u9686\u5143\u7d20\u4ee5\u53ca\u6240\u6709\u7684\u539a\u70b9\u8282\u70b9\n    false   \u4ec5\u4ec5\u514b\u9686\u8282\u70b9\u672c\u8eab\n<\/code><\/pre>\n<h3>7-6 DocumentFragment<\/h3>\n<pre><code>document.createDocumentFragment()\u53ef\u4ee5\u521b\u5efa\u8be5\u5bf9\u8c61\n\nDocumentFragment \u63a5\u53e3\u8868\u793a\u6587\u6863\u7684\u4e00\u90e8\u5206\uff08\u6216\u4e00\u6bb5\uff09\u3002\u66f4\u786e\u5207\u5730\u8bf4\uff0c\u5b83\u8868\u793a\u4e00\u4e2a\u6216\u591a\u4e2a\u90bb\u63a5\u7684 Document \u8282\u70b9\u548c\u5b83\u4eec\u7684\u6240\u6709\u5b50\u5b59\u8282\u70b9\u3002\n\nDocumentFragment \u8282\u70b9\u4e0d\u5c5e\u4e8e\u6587\u6863\u6811\uff0c\u7ee7\u627f\u7684 parentNode \u5c5e\u6027\u603b\u662f null\u3002\n\n\u8bf7\u6c42\u628a\u4e00\u4e2a DocumentFragment \u8282\u70b9\u63d2\u5165\u6587\u6863\u6811\u65f6\uff0c\u63d2\u5165\u7684\u4e0d\u662f DocumentFragment \u81ea\u8eab\uff0c\u800c\u662f\u5b83\u7684\u6240\u6709\u5b50\u5b59\u8282\u70b9\u3002\u8fd9\u4f7f\u5f97 DocumentFragment \u6210\u4e86\u6709\u7528\u7684\u5360\u4f4d\u7b26\uff0c\u6682\u65f6\u5b58\u653e\u90a3\u4e9b\u4e00\u6b21\u63d2\u5165\u6587\u6863\u7684\u8282\u70b9\n<\/code><\/pre>\n<h2>8\u3001\u5143\u7d20\u7684\u5c3a\u5bf8\u3001\u4f4d\u7f6e\u3001\u6eda\u52a8<\/h2>\n<h3>8-1 \u5143\u7d20\u5750\u6807<\/h3>\n<pre><code>offsetLeft  \u8ddd\u79bb\u5de6\u8fb9\u7684\u8ddd\u79bb, \u76f8\u5bf9\u89c4\u5219\u540c css \u7684\u5b9a\u4f4d\noffsetTop   \u8ddd\u79bb\u4e0a\u8fb9\u7684\u8ddd\u79bb, \u76f8\u5bf9\u89c4\u5219\u540c css \u7684\u5b9a\u4f4d\noffsetParent    \u5f97\u5230\u7b2c\u4e00\u5b9a\u4f4d\u7684\u7956\u5148\u5143\u7d20\nclientLeft  \u6ca1\u5375\u7528 \u5c31\u662f\u8fb9\u6846\u5bbd\nclientTop   \u6ca1\u5375\u7528 \u5c31\u662f\u8fb9\u6846\u5bbd\ngetBoundingClientRect()     \u8fd4\u56de\u5bf9\u8c61 \u5305\u542b\u4f4d\u7f6e\u4fe1\u606f \u5927\u5c0f\u4fe1\u606f\n<\/code><\/pre>\n<h3>8-2 \u5224\u5b9a\u67d0\u4e2a\u5143\u7d20\u5728\u67d0\u70b9<\/h3>\n<pre><code>document.elementFromPoint()\n<\/code><\/pre>\n<h3>8-3 \u67e5\u8be2\u5143\u7d20\u7684\u51e0\u4f55\u5c3a\u5bf8<\/h3>\n<pre><code>getBoundingClientRect()\ngetClientRects()\noffsetWidth\noffsetHeight\nclientWidth\nclientHeight\nscrollWidth\nscrollHeight\n<\/code><\/pre>\n<h3>8-4 \u6eda\u52a8<\/h3>\n<pre><code>scrollLeft\nscrollTop\n<\/code><\/pre>\n<h2>9\u3001Document\u5bf9\u8c61<\/h2>\n<p>\u6bcf\u4e2a\u8f7d\u5165\u6d4f\u89c8\u5668\u7684 HTML \u6587\u6863\u90fd\u4f1a\u6210\u4e3a Document \u5bf9\u8c61\u3002<br \/>\nDocument \u5bf9\u8c61\u4f7f\u6211\u4eec\u53ef\u4ee5\u4ece\u811a\u672c\u4e2d\u5bf9 HTML \u9875\u9762\u4e2d\u7684\u6240\u6709\u5143\u7d20\u8fdb\u884c\u8bbf\u95ee\u3002<\/p>\n<h3>9-1 \u5c5e\u6027<\/h3>\n<pre><code>URL     \u83b7\u53d6\u5f53\u524d\u9875\u9762\u7684url \u53ea\u8bfb\ndomain      \u83b7\u53d6\u57df\u540d\nreferrer        \u83b7\u53d6\u4e0a\u4e00\u4e2a\u9875\u9762\u7684\u5730\u5740 \u53ea\u8bfb\ntitle       \nlocation    \nlastModified    \ncookie      \n<\/code><\/pre>\n<h3>9-2 \u65b9\u6cd5<\/h3>\n<pre><code>write()     \nwriteln()   \n<\/code><\/pre>\n<h2>10\u3001HTML\u8868\u5355\u4e2d\u7684\u76f8\u5173\u5bf9\u8c61<\/h2>\n<h3>10-1 \u9009\u53d6\u8868\u5355\u548c\u8868\u5355\u5143\u7d20<\/h3>\n<h3>10-2 \u8868\u5355\u548c\u8868\u5355\u5143\u7d20\u7684\u5c5e\u6027<\/h3>\n<h3>10-3 from\u5bf9\u8c61<\/h3>\n<h4>\u5c5e\u6027<\/h4>\n<pre><code>elements    \u6240\u6709\u8868\u5355\u63a7\u4ef6\u7ec4\u6210\u7684\u96c6\u5408\n<\/code><\/pre>\n<h4>\u65b9\u6cd5<\/h4>\n<pre><code>submit()    \u8ba9\u8868\u5355\u63d0\u4ea4\nreset()     \u8ba9\u8868\u5355\u91cd\u7f6e\n<\/code><\/pre>\n<p>\u200b       <\/p>\n<h3>10-4 \u6309\u94ae(button submit reset)\u5bf9\u8c61<\/h3>\n<h4>\u65b9\u6cd5<\/h4>\n<pre><code>focus() \u83b7\u5f97\u7126\u70b9\nblur()  \u4f7f\u5931\u53bb\u7126\u70b9\nclick() \u4f7f\u6309\u94ae\u6bd4\u88ab\u5355\u51fb\n<\/code><\/pre>\n<h3>10-5 \u5355\u9009\u590d\u9009<\/h3>\n<h4>\u65b9\u6cd5<\/h4>\n<pre><code>focus() \u83b7\u5f97\u7126\u70b9\nblur()  \u5931\u53bb\u7126\u70b9\nclick() \u88ab\u5355\u51fb\n<\/code><\/pre>\n<p>\u200b       <\/p>\n<h3>10-6 \u6587\u672c(input textarea)<\/h3>\n<h4>\u65b9\u6cd5<\/h4>\n<pre><code>focus() \u83b7\u53d6\u7126\u70b9\nblur()  \u5931\u53bb\u7126\u70b9\nselect()    \u5168\u90e8\u88ab\u9009\u4e2d\n<\/code><\/pre>\n<p>\u200b       <\/p>\n<h3>10-7 select\u5bf9\u8c61<\/h3>\n<h4>\u5c5e\u6027<\/h4>\n<pre><code>options\nselectedIndex\nlength  \u9009\u9879\u7684\u6570\u91cf\n<\/code><\/pre>\n<h4>\u65b9\u6cd5<\/h4>\n<pre><code>add()   \u6dfb\u52a0\u9009\u9879\nremove()    \u79fb\u51fa\u9009\u9879, \u53c2\u6570\u662foption\u7684\u7d22\u5f15\nfocus() \u83b7\u53d6\u7126\u70b9\nblur()  \u5931\u53bb\u7126\u70b9\n<\/code><\/pre>\n<h2>11\u3001Table\u4e2d\u76f8\u5173\u5bf9\u8c61<\/h2>\n<h3>11-1 table\u5bf9\u8c61<\/h3>\n<h4>\u5c5e\u6027<\/h4>\n<pre><code>cells   \u8fd4\u56de\u5305\u542b\u8868\u683c\u4e2d\u6240\u6709\u5355\u5143\u683c\u7684\u4e00\u4e2a\u6570\u7ec4\u3002\nrows    \u8fd4\u56de\u5305\u542b\u8868\u683c\u4e2d\u6240\u6709\u884c\u7684\u4e00\u4e2a\u6570\u7ec4\u3002\n<\/code><\/pre>\n<h4>\u65b9\u6cd5<\/h4>\n<pre><code>createCaption() \u4e3a\u8868\u683c\u521b\u5efa\u4e00\u4e2a caption \u5143\u7d20\u3002\ndeleteCaption() \u4ece\u8868\u683c\u5220\u9664 caption \u5143\u7d20\u4ee5\u53ca\u5176\u5185\u5bb9\u3002\ncreateTHead()   \u5728\u8868\u683c\u4e2d\u521b\u5efa\u4e00\u4e2a\u7a7a\u7684 tHead \u5143\u7d20\u3002\ndeleteTHead()   \u4ece\u8868\u683c\u5220\u9664 tHead \u5143\u7d20\u53ca\u5176\u5185\u5bb9\u3002\ncreateTFoot()   \u5728\u8868\u683c\u4e2d\u521b\u5efa\u4e00\u4e2a\u7a7a\u7684 tFoot \u5143\u7d20\u3002\ndeleteTFoot()   \u4ece\u8868\u683c\u5220\u9664 tFoot \u5143\u7d20\u53ca\u5176\u5185\u5bb9\u3002\ninsertRow() \u5728\u8868\u683c\u4e2d\u63d2\u5165\u4e00\u4e2a\u65b0\u884c\u3002\ndeleteRow() \u4ece\u8868\u683c\u5220\u9664\u4e00\u884c\u3002\n<\/code><\/pre>\n<h3>11-2 tr\u5bf9\u8c61<\/h3>\n<h4>\u5c5e\u6027<\/h4>\n<pre><code>cells   \u8fd4\u56de\u5305\u542b\u884c\u4e2d\u6240\u6709\u5355\u5143\u683c\u7684\u4e00\u4e2a\u6570\u7ec4\u3002\nrowIndex    \u8fd4\u56de\u8be5\u884c\u5728\u8868\u4e2d\u7684\u4f4d\u7f6e\u3002\n<\/code><\/pre>\n<h4>\u65b9\u6cd5<\/h4>\n<pre><code>deleteCell()    \u5220\u9664\u884c\u4e2d\u7684\u6307\u5b9a\u7684\u5355\u5143\u683c\u3002\ninsertCell()    \u5728\u4e00\u884c\u4e2d\u7684\u6307\u5b9a\u4f4d\u7f6e\u63d2\u5165\u4e00\u4e2a\u7a7a\u7684 &lt;td&gt; \u5143\u7d20\u3002\n<\/code><\/pre>\n<p>\u200b       <\/p>\n<h3>11-3 td\u5bf9\u8c61\u3001th\u5bf9\u8c61<\/h3>\n<h4>\u5c5e\u6027<\/h4>\n<pre><code>cellIndex   \u8fd4\u56de\u5355\u5143\u683c\u5728\u67d0\u884c\u7684\u5355\u5143\u683c\u96c6\u5408\u4e2d\u7684\u4f4d\u7f6e\u3002\n<\/code><\/pre>\n<p>\u200b       <\/p>\n<p>\u200b       <\/p>\n<p>\u200b<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u6863\u5bf9\u8c61\u6a21\u578b DOM 1\u3001DOM\u6982\u8ff0 1-1 \u4ec0\u4e48\u662fDOM \u6587\u6863\u5bf9\u8c61\u6a21\u578b Document Object Mo [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[361,367],"tags":[],"_links":{"self":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts\/4762"}],"collection":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4762"}],"version-history":[{"count":0,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts\/4762\/revisions"}],"wp:attachment":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4762"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4762"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4762"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}