{"id":34,"date":"2007-07-20T23:06:49","date_gmt":"2007-07-21T03:06:49","guid":{"rendered":"http:\/\/prglab.com\/blog\/js-tutorial\/js-htmldom"},"modified":"2007-07-20T23:09:52","modified_gmt":"2007-07-21T03:09:52","slug":"js-htmldom","status":"publish","type":"page","link":"https:\/\/www.prglab.com\/blog\/js-tutorial\/js-htmldom","title":{"rendered":"JavaScript HTML DOM \u5bf9\u8c61"},"content":{"rendered":"<p class=\"intro\">\u4f7f\u7528JavaScript\u9664\u4e86\u53ef\u4ee5\u8bbf\u95ee\u548c\u64cd\u4f5cJavaScript\u5185\u7f6e\u7684\u5bf9\u8c61\u5916\uff0c\u8fd8\u53ef\u4ee5\u5bf9HTML DOM\u5bf9\u8c61\u8fdb\u884c\u64cd\u4f5c\u3002<\/p>\n<hr \/>\n<h2>\u66f4\u591aJavaScript\u5bf9\u8c61<\/h2>\n<p>\u8fd9\u91cc\u5217\u51fa\u4e00\u4e9b\u5e38\u7528\u7684JS\u5bf9\u8c61<\/p>\n<table class=\"ex\" id=\"table3\" border=\"1\" cellspacing=\"0\" height=\"122\" width=\"480\">\n<tr>\n<th align=\"left\" width=\"25%\">\u5bf9\u8c61<\/th>\n<th align=\"left\" width=\"75%\">\u63cf\u8ff0<\/th>\n<\/tr>\n<tr>\n<td valign=\"top\">Window<\/td>\n<td valign=\"top\">JavaScript\u5206\u5c42\u7ed3\u6784\u4e2d\u6700\u9876\u5c42\u7684\u5bf9\u8c61\u3002Window\u5bf9\u8c61\u4ee3\u8868\u4e86\u6d4f\u89c8\u5668\u7a97\u53e3\u3002\u6bcf\u4e00\u4e2a&lt;body&gt; \u6216 &lt;frameset&gt; \u6807\u7b7e\u7684\u5b9e\u4f8b\u90fd\u4f1a\u81ea\u52a8\u751f\u6210\u4e00\u4e2aWindow\u5bf9\u8c61\u3002<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">Navigator<\/td>\n<td valign=\"top\">\u5b58\u50a8\u4e86\u6765\u8bbf\u7528\u6237\u7684\u6d4f\u89c8\u5668\u4fe1\u606f<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">Screen<\/td>\n<td valign=\"top\">\u5b58\u50a8\u4e86\u6765\u8bbf\u7528\u6237\u7684\u5c4f\u5e55\u663e\u793a\u4fe1\u606f<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">History<\/td>\n<td valign=\"top\">\u5b58\u50a8\u4e86\u6d4f\u89c8\u5668\u7a97\u53e3\u8bbf\u95ee\u8fc7\u7684URL\u4fe1\u606f<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">Location<\/td>\n<td valign=\"top\">\u5b58\u50a8\u4e86\u5f53\u524dURL\u7684\u4fe1\u606f<\/td>\n<\/tr>\n<\/table>\n<hr \/>\n<h2>HTML DOM<\/h2>\n<p>HTML DOM \u662f\u4e00\u4e2aW3C\u6807\u51c6\uff0c\u5b83\u662fHTML\u7684\u6587\u672c\u5bf9\u8c61\u6a21\u578b(Document  Object Model for HTML)\u7684\u7f29\u5199\u3002<\/p>\n<p>HTML DOM \u5b9a\u4e49\u4e86\u4e00\u5957HTML\u7684\u6807\u51c6\u5bf9\u8c61\uff0c\u4ee5\u53ca\u5bf9HTML\u6587\u672c\u5bf9\u8c61\u8bbf\u95ee\u548c\u64cd\u4f5c\u7684\u6807\u51c6\u65b9\u6cd5\u3002<\/p>\n<p>\u6240\u6709HTML \u5143\u7d20\uff0c\u8fde\u540c\u5b83\u4eec\u5305\u542b\u7684\u6587\u672c\u548c\u5c5e\u6027\uff0c\u90fd\u53ef\u4ee5\u901a\u8fc7DOM\u6765\u8bbf\u95ee\u3002\u5176\u5185\u5bb9\u53ef\u4ee5\u88ab\u4fee\u6539\u6216\u5220\u9664\uff0c\u5e76\u53ef\u4ee5\u751f\u6210\u65b0\u7684\u5143\u7d20\u3002<\/p>\n<p>HTML DOM \u662f\u72ec\u7acb\u4e8e\u5e73\u53f0\u548c\u7f16\u7a0b\u8bed\u8a00\u7684\u3002\u5b83\u53ef\u4ee5\u88ab\u4efb\u4f55\u7f16\u7a0b\u8bed\u8a00\u6240\u4f7f\u7528\uff0c\u4f8b\u5982Java, JavaScript, \u548c VBScript\u3002<\/p>\n<p>\u4e0b\u9762\u5217\u51fa\u4e3b\u8981\u7684DOM\u5bf9\u8c61\uff1a<\/p>\n<table class=\"ex\" id=\"table2\" border=\"1\" cellspacing=\"0\" height=\"504\" width=\"479\">\n<tr>\n<th align=\"left\" width=\"25%\">\u5bf9\u8c61<\/th>\n<th align=\"left\" width=\"75%\">\u63cf\u8ff0<\/th>\n<\/tr>\n<tr>\n<td valign=\"top\">Document<\/td>\n<td valign=\"top\">\u4ee3\u8868\u6574\u4e2aHTML\u6587\u4ef6\uff0c\u53ef\u4ee5\u88ab\u7528\u6765\u8bbf\u95ee\u4e00\u4e2a\u9875\u9762\u4e0a\u7684\u6240\u6709\u5143\u7d20\u3002<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">Anchor<\/td>\n<td valign=\"top\">\u4ee3\u8868\u4e00\u4e2a&lt;a&gt;\u5143\u7d20<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">Area<\/td>\n<td valign=\"top\">\u4ee3\u8868\u4e00\u4e2a image-map\u4e2d\u7684&lt;area&gt; \u5143\u7d20<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">Base<\/td>\n<td valign=\"top\">\u4ee3\u8868\u4e00\u4e2a &lt;base&gt; \u5143\u7d20<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">Body<\/td>\n<td valign=\"top\">\u4ee3\u8868\u4e00\u4e2athe &lt;body&gt; \u5143\u7d20<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">Button<\/td>\n<td valign=\"top\">\u4ee3\u8868\u4e00\u4e2a&lt;button&gt;\u5143\u7d20<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">Event<\/td>\n<td valign=\"top\">\u4ee3\u8868\u4e00\u4e2a\u4e8b\u4ef6event\u7684\u72b6\u6001<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">Form<\/td>\n<td valign=\"top\">\u4ee3\u8868\u4e00\u4e2a &lt;form&gt; \u5143\u7d20<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">Frame<\/td>\n<td valign=\"top\">\u4ee3\u8868\u4e00\u4e2a &lt;frame&gt; \u5143\u7d20<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">Frameset<\/td>\n<td valign=\"top\">\u4ee3\u8868\u4e00\u4e2a &lt;frameset&gt; \u5143\u7d20<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">Iframe<\/td>\n<td valign=\"top\">\u4ee3\u8868\u4e00\u4e2a &lt;iframe&gt; \u5143\u7d20<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">Image<\/td>\n<td valign=\"top\">\u4ee3\u8868\u4e00\u4e2a &lt;img&gt; \u5143\u7d20<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">Input button<\/td>\n<td valign=\"top\">\u4ee3\u8868\u4e00\u4e2aHTML form\u4e2d\u7684\u4e00\u4e2a\u6309\u94ae (button)<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">Input checkbox<\/td>\n<td valign=\"top\">\u4ee3\u8868\u4e00\u4e2aHTML form\u4e2d\u7684\u4e00\u4e2a\u590d\u9009\u6846(checkbox)<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">Input file<\/td>\n<td valign=\"top\">\u4ee3\u8868\u4e00\u4e2aHTML form\u4e2d\u7684\u4e00\u4e2a\u6587\u4ef6\u4e0a\u8f7d\u57df(fileupload)<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">Input hidden<\/td>\n<td valign=\"top\">\u4ee3\u8868\u4e00\u4e2aHTML form\u4e2d\u7684\u4e00\u4e2a\u9690\u85cf\u57df(hidden field)<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">Input password<\/td>\n<td valign=\"top\">\u4ee3\u8868\u4e00\u4e2aHTML form\u4e2d\u7684\u4e00\u4e2a\u5bc6\u7801\u57df(password field)<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">Input radio<\/td>\n<td valign=\"top\">\u4ee3\u8868\u4e00\u4e2aHTML form\u4e2d\u7684\u4e00\u4e2a\u5355\u9009\u6309\u94ae(radio button)<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">Input reset<\/td>\n<td valign=\"top\">\u4ee3\u8868\u4e00\u4e2aHTML form\u4e2d\u7684\u4e00\u4e2a\u91cd\u7f6e\u6309\u94ae(reset button)<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">Input submit<\/td>\n<td valign=\"top\">\u4ee3\u8868\u4e00\u4e2aHTML form\u4e2d\u7684\u4e00\u4e2a\u63d0\u4ea4\u6309\u94ae(submit button)<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">Input text<\/td>\n<td valign=\"top\">\u4ee3\u8868\u4e00\u4e2aHTML form\u4e2d\u7684\u4e00\u4e2a\u6587\u672c\u8f93\u5165\u6846(text-input field)<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">Link<\/td>\n<td valign=\"top\">\u4ee3\u8868\u4e00\u4e2a &lt;link&gt; \u5143\u7d20<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">Meta<\/td>\n<td valign=\"top\">\u4ee3\u8868\u4e00\u4e2a &lt;meta&gt; \u5143\u7d20<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">Option<\/td>\n<td valign=\"top\">\u4ee3\u8868\u4e00\u4e2a &lt;option&gt; \u5143\u7d20<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">Select<\/td>\n<td valign=\"top\">\u4ee3\u8868\u4e00\u4e2aHTML form\u4e2d\u7684\u4e00\u4e2a\u4e0b\u62c9\u83dc\u5355(selection list)<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">Style<\/td>\n<td valign=\"top\">\u4ee3\u8868\u4e00\u4e2a\u5355\u72ec\u7684\u98ce\u683c(style) \u8bed\u53e5<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">Table<\/td>\n<td valign=\"top\">\u4ee3\u8868\u4e00\u4e2a &lt;table&gt; \u5143\u7d20<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">TableData<\/td>\n<td valign=\"top\">\u4ee3\u8868\u4e00\u4e2a &lt;td&gt; \u5143\u7d20<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">TableRow<\/td>\n<td valign=\"top\">\u4ee3\u8868\u4e00\u4e2a &lt;tr&gt; \u5143\u7d20<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">Textarea<\/td>\n<td valign=\"top\">\u4ee3\u8868\u4e00\u4e2a &lt;textarea&gt; \u5143\u7d20<\/td>\n<\/tr>\n<\/table>\n<hr \/>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528JavaScript\u9664\u4e86\u53ef\u4ee5\u8bbf\u95ee\u548c\u64cd\u4f5cJavaScript\u5185\u7f6e\u7684\u5bf9\u8c61\u5916\uff0c\u8fd8\u53ef\u4ee5\u5bf9HTML DOM\u5bf9\u8c61\u8fdb\u884c\u64cd\u4f5c\u3002 \u66f4\u591aJavaScript\u5bf9\u8c61 \u8fd9\u91cc\u5217\u51fa\u4e00\u4e9b\u5e38\u7528\u7684JS\u5bf9\u8c61 \u5bf9\u8c61 \u63cf\u8ff0 Window JavaScript\u5206\u5c42\u7ed3\u6784\u4e2d\u6700\u9876\u5c42\u7684\u5bf9\u8c61\u3002Window\u5bf9\u8c61\u4ee3\u8868\u4e86\u6d4f\u89c8\u5668\u7a97\u53e3\u3002\u6bcf\u4e00\u4e2a&lt;body&gt; \u6216 &lt;frameset&gt; \u6807\u7b7e\u7684\u5b9e\u4f8b\u90fd\u4f1a\u81ea\u52a8\u751f\u6210\u4e00\u4e2aWindow\u5bf9\u8c61\u3002 Navigator \u5b58\u50a8\u4e86\u6765\u8bbf\u7528\u6237\u7684\u6d4f\u89c8\u5668\u4fe1\u606f Screen \u5b58\u50a8\u4e86\u6765\u8bbf\u7528\u6237\u7684\u5c4f\u5e55\u663e\u793a\u4fe1\u606f History \u5b58\u50a8\u4e86\u6d4f\u89c8\u5668\u7a97\u53e3\u8bbf\u95ee\u8fc7\u7684URL\u4fe1\u606f Location \u5b58\u50a8\u4e86\u5f53\u524dURL\u7684\u4fe1\u606f HTML DOM HTML DOM \u662f\u4e00\u4e2aW3C\u6807\u51c6\uff0c\u5b83\u662fHTML\u7684\u6587\u672c\u5bf9\u8c61\u6a21\u578b(Document Object Model for HTML)\u7684\u7f29\u5199\u3002 HTML DOM \u5b9a\u4e49\u4e86\u4e00\u5957HTML\u7684\u6807\u51c6\u5bf9\u8c61\uff0c\u4ee5\u53ca\u5bf9HTML\u6587\u672c\u5bf9\u8c61\u8bbf\u95ee\u548c\u64cd\u4f5c\u7684\u6807\u51c6\u65b9\u6cd5\u3002 \u6240\u6709HTML \u5143\u7d20\uff0c\u8fde\u540c\u5b83\u4eec\u5305\u542b\u7684\u6587\u672c\u548c\u5c5e\u6027\uff0c\u90fd\u53ef\u4ee5\u901a\u8fc7DOM\u6765\u8bbf\u95ee\u3002\u5176\u5185\u5bb9\u53ef\u4ee5\u88ab\u4fee\u6539\u6216\u5220\u9664\uff0c\u5e76\u53ef\u4ee5\u751f\u6210\u65b0\u7684\u5143\u7d20\u3002 HTML DOM \u662f\u72ec\u7acb\u4e8e\u5e73\u53f0\u548c\u7f16\u7a0b\u8bed\u8a00\u7684\u3002\u5b83\u53ef\u4ee5\u88ab\u4efb\u4f55\u7f16\u7a0b\u8bed\u8a00\u6240\u4f7f\u7528\uff0c\u4f8b\u5982Java, JavaScript, \u548c VBScript\u3002 \u4e0b\u9762\u5217\u51fa\u4e3b\u8981\u7684DOM\u5bf9\u8c61\uff1a \u5bf9\u8c61 \u63cf\u8ff0 Document \u4ee3\u8868\u6574\u4e2aHTML\u6587\u4ef6\uff0c\u53ef\u4ee5\u88ab\u7528\u6765\u8bbf\u95ee\u4e00\u4e2a\u9875\u9762\u4e0a\u7684\u6240\u6709\u5143\u7d20\u3002 Anchor \u4ee3\u8868\u4e00\u4e2a&lt;a&gt;\u5143\u7d20 Area \u4ee3\u8868\u4e00\u4e2a image-map\u4e2d\u7684&lt;area&gt; \u5143\u7d20 Base \u4ee3\u8868\u4e00\u4e2a &lt;base&gt; \u5143\u7d20 Body [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":3,"menu_order":24,"comment_status":"open","ping_status":"open","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/www.prglab.com\/blog\/wp-json\/wp\/v2\/pages\/34"}],"collection":[{"href":"https:\/\/www.prglab.com\/blog\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.prglab.com\/blog\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.prglab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.prglab.com\/blog\/wp-json\/wp\/v2\/comments?post=34"}],"version-history":[{"count":0,"href":"https:\/\/www.prglab.com\/blog\/wp-json\/wp\/v2\/pages\/34\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/www.prglab.com\/blog\/wp-json\/wp\/v2\/pages\/3"}],"wp:attachment":[{"href":"https:\/\/www.prglab.com\/blog\/wp-json\/wp\/v2\/media?parent=34"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}