DOM(文档对象模型)

DOM(文档对象模型),第1张

目录

1.简介

DOM(文档对象模型)提供了访问和 *** 作网页内容的方法和接口。

DOM1级规范: 由DOM Core和DOM HTML两个模块组成。DOM Core规定如何映射XML的文档结构,以便简化对文档中任意部分的 *** 作。DOM HTML在DOM Core上加以扩展,添加了针对HTML的对象和方法。

2.DOM1 ①节点关系

DOM将任何HTML或XML文档描绘成一个由多层节点构成的结构。

JS中的所有节点类型都继承自Node类型,所以所有节点都有一些共同的属性和方法
每个节点都有一个nodeType属性,用于表明节点的类型,共有12种。
我们也可以使用nodeName和nodeValue属性查看节点信息。

(1)每个节点都有一个childNodes属性,其中保存一个NodeList对象,NodeList是一种类数组对象,保存了一组有序的节点,可通过位置下标来访问,也有length属性,但它不是Array的实例,可使用中括号或使用 item() 方法访问 NodeList 中的元素。
查询一个节点是否有子节点:利用hasChildNodes()方法或length属性

let firstChild = someNode.childNodes[0];
let secondChild = someNode.childNodes.item(1);

(2)每个节点都有一个 parentNode 属性,指向其 DOM 树中的父元素。 
childNodes 列表中的每个节点都是同一列表中其他节点的同胞节点,使用 previousSiblingnextSibling 属性可以访问同一列表中的其它节点。 
父节点的第一个及最后一个子节点有专门属性: firstChild 和 lastChild

(3)共有属性ownerDocument是一个指向代表整个文档的文档节点的指针。 

② *** 作节点

(1)appendChild() :用于在 childNodes 列表末尾添加节点。如果添加的是文档中已经存在的节点,那么之前位置的那个节点会被移除。
(2)insertBefore() :把节点放到 childNodes 中的特定位置,该方法接收两个参数:要插入的节点和参照节点。
(3)replaceChild() :替换节点。该方法接收两个参数:要插入的节点和要替换的节点。(4)removeChild() :移除节点。该这个方法接收一个参数,即要移除的节点。
(5)cloneNode() :返回与调用它的节点一模一样的节点。 该方法接收一个布尔值参数,表示是否深复制。传入true参数,会进行深复制,即复制节点及其整个子 DOM树。传入false ,则只复制调用该方法的节点。
(6)normalize():处理文档子树中的文本节点。检测调用节点的所有后代,如果发现空文本节点,将其删除;如果两个同胞文本节点是相邻的,则将其合并为一个文本节点。

③Document 类型

浏览器中,文档对象 document 是HTMLDocument 的实例,表示整个 HTML页面。 document 是 window对象的一个属性,因此是一个全局对象。

document.documentElement: 指向 元素,也可以通过 childNodes 列表访问
document.body:指向 元素
document.doctype 属性: 指向一个DocumentType 对象,包含文档的文档类型信息, 就是标签里面的一些东西,也可以通过 childNodes 列表访问
理论上,出现在标签外部的注释应该算文档的子节点,然而不同浏览器在是否解析这些注释方面存在很大差异。

document 作为 HTMLDocument 的实例,还有一些标准 Document 对象上所没有的属性:

document.title:读取文档标题,可以修改 title 属性但并不会改变 元素<br /><span >document.URL:</span>取得完整的 URL<br /><span >document.domain:</span>取得域名<br /><span >document.referrer:</span>取得来源,没有来源就是空字符串<br />所有这些信息都可以在请求的 HTTP 头部信息中获取</p> <span >④查找元素</span> <p><span >document.getElementById()、document.getElementsById()<br /> document.getElementsByTagName() :</span>返回一个HTMLCollection对象,可通过中括号或 item() 方法从中取得特定的元素;该对象还有一个方法namedItem() ,可通过标签的 name 属性取得集合中的项;HTMLCollection对象本身也支持通过["name属性名"]的方式获取列表项。<br />获取页面中的所有元素:document.getElementsByTagName("*")<br /><span >getElementsByName():</span>返回具有给定 name 属性的所有元素,也返回一个HTMLCollection对象,最常用于单选框,所有单选框id不同,但是name相同,从而保证了只将一个值发送给服务器({name:xxx})</p> <span >⑤文档写入</span> <p><span >document.write()、document.writeln():</span>向网页输出流中写入内容,后者比前者多个换行符</p> <pre><code># 在页面加载期间向页面中动态添加内容 document.write("" + (new Date()).toString() + ""); # 动态包含外部资源,"<\/script>" 是为了防止输出的</script>匹配最外层的<script>标签 document.write("<script type=\"text/javascript\" src=\"file.js\">" + "<\/script>");</code></pre> <p><span >document.open() 、document.close() :</span>分别用于打开和关闭网页输出流</p> <span >⑥Element 类型</span> <p><span >nodeType 等于 1</span></p> <p><span >获取元素的标签名:</span>用<span >nodeName 或 tagName 属性</span><br />在 HTML 中,元素标签名始终以大写表示(比如 xxx.tagName返回的是“DIV”);在 XML(包括 XHTML)中,标签名始终与源代码中的大小写一致。(适用不同文档写法:element.tagName.toLowerCase() == "div")<br /><span >HTML元素中的属性:</span>id 、title (包含元素的额外信息,通常以提示条形式展示)、lang (元素内容的语言代码)、dir (语言的书写方向,"ltr" :从左到右, "rtl" :从右到左)、className。</p> <span >⑦操作属性</span> <p><span >getAttribute() :</span>拿到属性值,比如xxx.getAttribute("class"),调用对象属性用className,这里用class。也能拿到自己定义的属性,但是除了IE,自定义属性是不会被添加到DOM对象中的。<br /><span >setAttribute() :</span>接收要设置的属性名和属性的值两个参数。有目标属性就覆盖其值,没有就创建。<br /><span >removeAttribute() :</span>用于从元素中删除属性</p> <span >3.DOM2</span><div class="entry-copyright"><p>欢迎分享,转载请注明来源:<a href="https://www.54852.com" title="内存溢出">内存溢出</a></p><p>原文地址:<a href="https://www.54852.com/web/1320800.html" title="DOM(文档对象模型)">https://www.54852.com/web/1320800.html</a></p></div></div><div class="entry-tag"><a href="/tag/4432.html" rel="tag">xml</a><a href="/tag/75.html" rel="tag">javascript</a><a href="/tag/23121.html" rel="tag">dom</a></div><div class="entry-action"><a id="thread-like" class="btn-zan" href="javascript:;" tid="1320800"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-thumb-up-fill"></use></svg></i>赞 <span class="entry-action-num">(0)</span></a><div class="btn-dashang"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-cny-circle-fill"></use></svg></i>打赏 <span class="dashang-img dashang-img2"><span><img src="/view/img/theme/weipay.png" alt="微信扫一扫" />微信扫一扫 </span><span><img src="/view/img/theme/alipay.png" alt="支付宝扫一扫" />支付宝扫一扫 </span></span></div></div><div class="entry-bar"><div class="entry-bar-inner clearfix"><div class="author pull-left"><a data-user="82293" target="_blank" href="/user/82293.html" class="avatar j-user-card"><img alt="语言工具" src="/view/img/avatar.png" class="avatar avatar-60 photo" height="60" width="60" /><span class="author-name">语言工具</span><span class="user-group">一级用户组</span></a></div><div class="info pull-right"><div class="info-item meta"><a class="meta-item j-heart" id="favorites" rel="nofollow" tid="1320800" href="javascript:void(0);" title="自己的内容还要收藏吗?" aria-label="自己的内容还要收藏吗?"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-star"></use></svg></i><span class="data">0</span></a><a class="meta-item" href="#comments"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-comment"></use></svg></i><span class="data">0</span></a></div><div class="info-item share"><a class="meta-item mobile j-mobile-share22" a href="javascript:;" data-event="poster-popover"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-share"></use></svg></i> 生成海报 </a><a class="meta-item wechat" data-share="wechat" target="_blank" rel="nofollow" href="#"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-wechat"></use></svg></i></a><a class="meta-item weibo" data-share="weibo" target="_blank" rel="nofollow" href="#"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-weibo"></use></svg></i></a><a class="meta-item qq" data-share="qq" target="_blank" rel="nofollow" href="#"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-qq"></use></svg></i></a><a class="meta-item qzone" data-share="qzone" target="_blank" rel="nofollow" href="#"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-qzone"></use></svg></i></a></div><div class="info-item act"><a href="javascript:;" id="j-reading"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-article"></use></svg></i></a></div></div></div></div></div><div class="wrap"><script src="https://v.2lian.com/static/s/tubiao.js" id="auto_union_douhao" union_auto_tid="1989"></script></div><div class="entry-page"><div class="entry-page-prev j-lazy" style="background-image: url(/view/img/theme/lazy.png);" data-original="/aiimages/Webstorm2022.1.1+%E9%85%8D%E7%BD%AEconsole.log%E5%BF%AB%E9%80%9F%E6%89%93%E5%8D%B0.png"><a href="/web/1320799.html" title="Webstorm2022.1.1 配置console.log快速打印" rel="prev"><span>Webstorm2022.1.1 配置console.log快速打印</span></a><div class="entry-page-info"><span class="pull-left"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-arrow-left-double"></use></svg></i>上一篇 </span><span class="pull-right">2022-06-11</span></div></div><div class="entry-page-next j-lazy" style="background-image: url(/view/img/theme/lazy.png);" data-original="/aiimages/HTTP%E8%AF%B7%E6%B1%82%E4%B8%ADtoken%E5%92%8Ccookie+%E5%8C%BA%E5%88%AB.png"><a href="/web/1320801.html" title="HTTP请求中token和cookie 区别" rel="next"><span>HTTP请求中token和cookie 区别</span></a><div class="entry-page-info"><span class="pull-right"> 下一篇<i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-arrow-right-double"></use></svg></i></span><span class="pull-left">2022-06-11</span></div></div></div><div id="comments" class="entry-comments"><div id="respond" class="comment-respond"><h3 id="reply-title" class="comment-reply-title"> 发表评论 </h3><div class="comment-form"><div class="comment-must-login"> 请登录后评论... </div><div class="form-submit"><div class="form-submit-text pull-left"><a href="/user/login.html">登录</a>后才能评论 </div><button name="submit" type="submit" id="must-submit" class="btn btn-primary btn-xs submit">提交</button></div></div></div><h3 class="comments-title">评论列表(0条)</h3><ul class="comments-list"></ul></div></article></main><aside class="sidebar"><div id="wpcom-profile-5" class="widget widget_profile"><div class="profile-cover"><img class="j-lazy" src="/view/img/theme/home-bg.jpg" alt="语言工具" /></div><div class="avatar-wrap"><a target="_blank" href="/user/82293.html" class="avatar-link"><img alt="语言工具" src="/view/img/avatar.png" class="avatar avatar-120 photo" height="120" width="120" /></a></div><div class="profile-info"><a target="_blank" href="/user/82293.html" class="profile-name"><span class="author-name">语言工具</span><span class="user-group">一级用户组</span></a><div class="profile-stats"><div class="profile-stats-inner"><div class="user-stats-item"><b>228</b><span>文章</span></div><div class="user-stats-item"><b>0</b><span>评论</span></div><div class="user-stats-item"><b>0</b><span>问题</span></div><div class="user-stats-item"><b>0</b><span>回答</span></div></div></div><button type="button" class="btn btn-primary btn-xs btn-message j-message2" data-toggle="modal" data-target="#mySnsQrocde"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-mail-fill"></use></svg></i>私信 </button><div class="modal fade" id="mySnsQrocde"><div class="modal-dialog"><div class="modal-content"><div class="modal-body" style="text-align: center"><img src="/upload/sns_qrcode/82293.png" style="width: 300px"></div></div></div></div></div><div class="profile-posts"><h3 class="widget-title"><span>最近文章</span></h3><ul><li><a href="/zaji/5794331.html" title="《蜀山战纪》大结局是什么?">《蜀山战纪》大结局是什么?</a></li><li><a href="/bake/5781611.html" title="炖羊肉放什么菜 炖羊肉放哪些菜好吃">炖羊肉放什么菜 炖羊肉放哪些菜好吃</a></li><li><a href="/bake/5772191.html" title="联想小新air14pro插口作用介绍">联想小新air14pro插口作用介绍</a></li><li><a href="/bake/5733375.html" title="夏季一天20度电正常吗">夏季一天20度电正常吗</a></li><li><a href="/zaji/5692449.html" title="【BUG关键词 ASM ,解决方案切换JDK版本】">【BUG关键词 ASM ,解决方案切换JDK版本】</a></li></ul></div></div><div id="wpcom-post-thumb-5" class="widget widget_post_thumb"><h3 class="widget-title"><span>相关文章</span></h3><ul><li class="item"><div class="item-img"><a class="item-img-inner" href="/bake/2800247.html" title="dom是什么牌子时装手表"><img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="dom是什么牌子时装手表" data-original="/aiimages/dom%E6%98%AF%E4%BB%80%E4%B9%88%E7%89%8C%E5%AD%90%E6%97%B6%E8%A3%85%E6%89%8B%E8%A1%A8.png" /></a></div><div class="item-content"><p class="item-title"><a href="/bake/2800247.html" title="dom是什么牌子时装手表">dom是什么牌子时装手表</a></p><p class="item-date">2022-8-23</p></div></li><li class="item"><div class="item-img"><a class="item-img-inner" href="/bake/2788750.html" title="dom是哪个国家的品牌?"><img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="dom是哪个国家的品牌?" data-original="/aiimages/dom%E6%98%AF%E5%93%AA%E4%B8%AA%E5%9B%BD%E5%AE%B6%E7%9A%84%E5%93%81%E7%89%8C%EF%BC%9F.png" /></a></div><div class="item-content"><p class="item-title"><a href="/bake/2788750.html" title="dom是哪个国家的品牌?">dom是哪个国家的品牌?</a></p><p class="item-date">2022-8-22</p></div></li><li class="item"><div class="item-img"><a class="item-img-inner" href="/web/1322682.html" title="【BOM】深入浅出浏览器对象模型—BOM基础知识详解"><img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="【BOM】深入浅出浏览器对象模型—BOM基础知识详解" data-original="/aiimages/%E3%80%90BOM%E3%80%91%E6%B7%B1%E5%85%A5%E6%B5%85%E5%87%BA%E6%B5%8F%E8%A7%88%E5%99%A8%E5%AF%B9%E8%B1%A1%E6%A8%A1%E5%9E%8B%E2%80%94BOM%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86%E8%AF%A6%E8%A7%A3.png" /></a></div><div class="item-content"><p class="item-title"><a href="/web/1322682.html" title="【BOM】深入浅出浏览器对象模型—BOM基础知识详解">【BOM】深入浅出浏览器对象模型—BOM基础知识详解</a></p><p class="item-date">2022-6-12</p></div></li><li class="item"><div class="item-img"><a class="item-img-inner" href="/web/1320816.html" title="【DOM】了解HTML DOM常用对象: 对常用元素的简化 *** 作"><img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="【DOM】了解HTML DOM常用对象: 对常用元素的简化 *** 作" data-original="/aiimages/%E3%80%90DOM%E3%80%91%E4%BA%86%E8%A7%A3HTML+DOM%E5%B8%B8%E7%94%A8%E5%AF%B9%E8%B1%A1%3A+%E5%AF%B9%E5%B8%B8%E7%94%A8%E5%85%83%E7%B4%A0%E7%9A%84%E7%AE%80%E5%8C%96%E6%93%8D%E4%BD%9C.png" /></a></div><div class="item-content"><p class="item-title"><a href="/web/1320816.html" title="【DOM】了解HTML DOM常用对象: 对常用元素的简化 *** 作">【DOM】了解HTML DOM常用对象: 对常用元素的简化 *** 作</a></p><p class="item-date">2022-6-11</p></div></li><li class="item"><div class="item-img"><a class="item-img-inner" href="/web/1320800.html" title="DOM(文档对象模型)"><img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="DOM(文档对象模型)" data-original="/aiimages/DOM%EF%BC%88%E6%96%87%E6%A1%A3%E5%AF%B9%E8%B1%A1%E6%A8%A1%E5%9E%8B%EF%BC%89.png" /></a></div><div class="item-content"><p class="item-title"><a href="/web/1320800.html" title="DOM(文档对象模型)">DOM(文档对象模型)</a></p><p class="item-date">2022-6-11</p></div></li><li class="item"><div class="item-img"><a class="item-img-inner" href="/web/1297028.html" title="(前端笔记)JS中table+form+onload+onblur+onfocus+正则校验+手动submit到Java后端"><img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="(前端笔记)JS中table+form+onload+onblur+onfocus+正则校验+手动submit到Java后端" data-original="/aiimages/%EF%BC%88%E5%89%8D%E7%AB%AF%E7%AC%94%E8%AE%B0%EF%BC%89JS%E4%B8%ADtable%2Bform%2Bonload%2Bonblur%2Bonfocus%2B%E6%AD%A3%E5%88%99%E6%A0%A1%E9%AA%8C%2B%E6%89%8B%E5%8A%A8submit%E5%88%B0Java%E5%90%8E%E7%AB%AF.png" /></a></div><div class="item-content"><p class="item-title"><a href="/web/1297028.html" title="(前端笔记)JS中table+form+onload+onblur+onfocus+正则校验+手动submit到Java后端">(前端笔记)JS中table+form+onload+onblur+onfocus+正则校验+手动submit到Java后端</a></p><p class="item-date">2022-6-10</p></div></li><li class="item"><div class="item-img"><a class="item-img-inner" href="/web/940736.html" title="Fiber 内部:React 中新的协调算法的深入概述"><img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="Fiber 内部:React 中新的协调算法的深入概述" data-original="/aiimages/Fiber+%E5%86%85%E9%83%A8%EF%BC%9AReact+%E4%B8%AD%E6%96%B0%E7%9A%84%E5%8D%8F%E8%B0%83%E7%AE%97%E6%B3%95%E7%9A%84%E6%B7%B1%E5%85%A5%E6%A6%82%E8%BF%B0.png" /></a></div><div class="item-content"><p class="item-title"><a href="/web/940736.html" title="Fiber 内部:React 中新的协调算法的深入概述">Fiber 内部:React 中新的协调算法的深入概述</a></p><p class="item-date">2022-5-17</p></div></li><li class="item"><div class="item-img"><a class="item-img-inner" href="/web/692519.html" title="DOM是什么意思"><img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="DOM是什么意思" data-original="/aiimages/DOM%E6%98%AF%E4%BB%80%E4%B9%88%E6%84%8F%E6%80%9D.png" /></a></div><div class="item-content"><p class="item-title"><a href="/web/692519.html" title="DOM是什么意思">DOM是什么意思</a></p><p class="item-date">2022-4-22</p></div></li><li class="item"><div class="item-img"><a class="item-img-inner" href="/web/619352.html" title="用javascript *** 作xml方法与技巧"><img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="用javascript *** 作xml方法与技巧" data-original="/aiimages/%E7%94%A8javascript%E6%93%8D%E4%BD%9Cxml%E6%96%B9%E6%B3%95%E4%B8%8E%E6%8A%80%E5%B7%A7.png" /></a></div><div class="item-content"><p class="item-title"><a href="/web/619352.html" title="用javascript *** 作xml方法与技巧">用javascript *** 作xml方法与技巧</a></p><p class="item-date">2022-4-15</p></div></li><li class="item"><div class="item-img"><a class="item-img-inner" href="/web/619350.html" title="ASP.NET2.0中"无法显示 XML 页。 使用 XSL 样式表无法查看 XML 输入。"><img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="ASP.NET2.0中"无法显示 XML 页。 使用 XSL 样式表无法查看 XML 输入。" data-original="/aiimages/ASP.NET2.0%E4%B8%AD%26quot%3B%E6%97%A0%E6%B3%95%E6%98%BE%E7%A4%BA+XML+%E9%A1%B5%E3%80%82+%E4%BD%BF%E7%94%A8+XSL+%E6%A0%B7%E5%BC%8F%E8%A1%A8%E6%97%A0%E6%B3%95%E6%9F%A5%E7%9C%8B+XML+%E8%BE%93%E5%85%A5%E3%80%82.png" /></a></div><div class="item-content"><p class="item-title"><a href="/web/619350.html" title="ASP.NET2.0中"无法显示 XML 页。 使用 XSL 样式表无法查看 XML 输入。">ASP.NET2.0中"无法显示 XML 页。 使用 XSL 样式表无法查看 XML 输入。</a></p><p class="item-date">2022-4-15</p></div></li><li class="item"><div class="item-img"><a class="item-img-inner" href="/web/619349.html" title="C#读写xml文件应用"><img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="C#读写xml文件应用" data-original="/aiimages/C%23%E8%AF%BB%E5%86%99xml%E6%96%87%E4%BB%B6%E5%BA%94%E7%94%A8.png" /></a></div><div class="item-content"><p class="item-title"><a href="/web/619349.html" title="C#读写xml文件应用">C#读写xml文件应用</a></p><p class="item-date">2022-4-15</p></div></li><li class="item"><div class="item-img"><a class="item-img-inner" href="/web/619345.html" title="XML标记语言的基本概念及语法入门教程"><img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="XML标记语言的基本概念及语法入门教程" data-original="/aiimages/XML%E6%A0%87%E8%AE%B0%E8%AF%AD%E8%A8%80%E7%9A%84%E5%9F%BA%E6%9C%AC%E6%A6%82%E5%BF%B5%E5%8F%8A%E8%AF%AD%E6%B3%95%E5%85%A5%E9%97%A8%E6%95%99%E7%A8%8B.png" /></a></div><div class="item-content"><p class="item-title"><a href="/web/619345.html" title="XML标记语言的基本概念及语法入门教程">XML标记语言的基本概念及语法入门教程</a></p><p class="item-date">2022-4-15</p></div></li><li class="item"><div class="item-img"><a class="item-img-inner" href="/web/619344.html" title="详解XML中的文档与声明用法"><img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="详解XML中的文档与声明用法" data-original="/aiimages/%E8%AF%A6%E8%A7%A3XML%E4%B8%AD%E7%9A%84%E6%96%87%E6%A1%A3%E4%B8%8E%E5%A3%B0%E6%98%8E%E7%94%A8%E6%B3%95.png" /></a></div><div class="item-content"><p class="item-title"><a href="/web/619344.html" title="详解XML中的文档与声明用法">详解XML中的文档与声明用法</a></p><p class="item-date">2022-4-15</p></div></li><li class="item"><div class="item-img"><a class="item-img-inner" href="/web/619342.html" title="详解XML中的标签与元素的使用"><img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="详解XML中的标签与元素的使用" data-original="/aiimages/%E8%AF%A6%E8%A7%A3XML%E4%B8%AD%E7%9A%84%E6%A0%87%E7%AD%BE%E4%B8%8E%E5%85%83%E7%B4%A0%E7%9A%84%E4%BD%BF%E7%94%A8.png" /></a></div><div class="item-content"><p class="item-title"><a href="/web/619342.html" title="详解XML中的标签与元素的使用">详解XML中的标签与元素的使用</a></p><p class="item-date">2022-4-15</p></div></li><li class="item"><div class="item-img"><a class="item-img-inner" href="/web/619341.html" title="XML中的属性学习教程"><img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="XML中的属性学习教程" data-original="/aiimages/XML%E4%B8%AD%E7%9A%84%E5%B1%9E%E6%80%A7%E5%AD%A6%E4%B9%A0%E6%95%99%E7%A8%8B.png" /></a></div><div class="item-content"><p class="item-title"><a href="/web/619341.html" title="XML中的属性学习教程">XML中的属性学习教程</a></p><p class="item-date">2022-4-15</p></div></li><li class="item"><div class="item-img"><a class="item-img-inner" href="/web/619340.html" title="深入解析XML中的字符实体与字符数据"><img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="深入解析XML中的字符实体与字符数据" data-original="/aiimages/%E6%B7%B1%E5%85%A5%E8%A7%A3%E6%9E%90XML%E4%B8%AD%E7%9A%84%E5%AD%97%E7%AC%A6%E5%AE%9E%E4%BD%93%E4%B8%8E%E5%AD%97%E7%AC%A6%E6%95%B0%E6%8D%AE.png" /></a></div><div class="item-content"><p class="item-title"><a href="/web/619340.html" title="深入解析XML中的字符实体与字符数据">深入解析XML中的字符实体与字符数据</a></p><p class="item-date">2022-4-15</p></div></li><li class="item"><div class="item-img"><a class="item-img-inner" href="/web/619337.html" title="详解XML中的代码注释书写方法"><img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="详解XML中的代码注释书写方法" data-original="/aiimages/%E8%AF%A6%E8%A7%A3XML%E4%B8%AD%E7%9A%84%E4%BB%A3%E7%A0%81%E6%B3%A8%E9%87%8A%E4%B9%A6%E5%86%99%E6%96%B9%E6%B3%95.png" /></a></div><div class="item-content"><p class="item-title"><a href="/web/619337.html" title="详解XML中的代码注释书写方法">详解XML中的代码注释书写方法</a></p><p class="item-date">2022-4-15</p></div></li><li class="item"><div class="item-img"><a class="item-img-inner" href="/web/619334.html" title="解析XML对代码中的空白处理"><img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="解析XML对代码中的空白处理" data-original="/aiimages/%E8%A7%A3%E6%9E%90XML%E5%AF%B9%E4%BB%A3%E7%A0%81%E4%B8%AD%E7%9A%84%E7%A9%BA%E7%99%BD%E5%A4%84%E7%90%86.png" /></a></div><div class="item-content"><p class="item-title"><a href="/web/619334.html" title="解析XML对代码中的空白处理">解析XML对代码中的空白处理</a></p><p class="item-date">2022-4-15</p></div></li><li class="item"><div class="item-img"><a class="item-img-inner" href="/web/619331.html" title="简单了解XML中的处理指令"><img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="简单了解XML中的处理指令" data-original="/aiimages/%E7%AE%80%E5%8D%95%E4%BA%86%E8%A7%A3XML%E4%B8%AD%E7%9A%84%E5%A4%84%E7%90%86%E6%8C%87%E4%BB%A4.png" /></a></div><div class="item-content"><p class="item-title"><a href="/web/619331.html" title="简单了解XML中的处理指令">简单了解XML中的处理指令</a></p><p class="item-date">2022-4-15</p></div></li><li class="item"><div class="item-img"><a class="item-img-inner" href="/web/619330.html" title="浅谈XML代码编写的编码与验证问题"><img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="浅谈XML代码编写的编码与验证问题" data-original="/aiimages/%E6%B5%85%E8%B0%88XML%E4%BB%A3%E7%A0%81%E7%BC%96%E5%86%99%E7%9A%84%E7%BC%96%E7%A0%81%E4%B8%8E%E9%AA%8C%E8%AF%81%E9%97%AE%E9%A2%98.png" /></a></div><div class="item-content"><p class="item-title"><a href="/web/619330.html" title="浅谈XML代码编写的编码与验证问题">浅谈XML代码编写的编码与验证问题</a></p><p class="item-date">2022-4-15</p></div></li></ul></div><div class="widget widget_post_thumb"><h3 class="widget-title"><span>随机标签</span></h3><div class="entry-tag"><a href="/tag/605726.html" rel="tag">热力设备</a><a href="/tag/605718.html" rel="tag">一任</a><a href="/tag/605699.html" rel="tag">充气泵</a><a href="/tag/605651.html" rel="tag">东送</a><a href="/tag/605633.html" rel="tag">白海豚</a><a href="/tag/605603.html" rel="tag">博客中国</a><a href="/tag/605532.html" rel="tag">朝天宫</a><a href="/tag/605529.html" rel="tag">为快</a><a href="/tag/605518.html" rel="tag">奶名</a><a href="/tag/605461.html" rel="tag">京港</a><a href="/tag/605460.html" rel="tag">十大热门</a><a href="/tag/605393.html" rel="tag">创先</a><a href="/tag/605390.html" rel="tag">考试办公室</a><a href="/tag/605366.html" rel="tag">那套</a><a href="/tag/605336.html" rel="tag">王学</a><a href="/tag/605335.html" rel="tag">兑美元</a><a href="/tag/605331.html" rel="tag">传染源</a><a href="/tag/605325.html" rel="tag">火q手</a><a href="/tag/605322.html" rel="tag">布里克</a><a href="/tag/605256.html" rel="tag">三下乡</a></div></div></aside></div></div> <footer class=footer> <div class=container> <div class=clearfix> <div class="footer-col footer-col-logo"> <img src="/view/img/logo.png" alt="WELLCMS"> </div> <div class="footer-col footer-col-copy"> <ul class="footer-nav hidden-xs"> <li class="menu-item"> <a href="https://www.54852.com/sitemap.html"> 网站地图 </a> </li> <li class="menu-item"> <a href="/read/0.html"> 联系我们 </a> </li> <li class="menu-item"> <a href="/read/0.html"> 行业动态 </a> </li> <li class="menu-item"> <a href="/read/0.html"> 专题列表 </a> </li> <!--<li class="menu-item"> <a href="/read/4.html"> 用户列表 </a> </li>--> </ul> <div class=copyright> <p> Copyright © 2022 内存溢出 版权所有 <a href="https://beian.miit.gov.cn" target="_blank" rel="nofollow noopener noreferrer"> 蜀ICP备2023005044号 </a> Powered by <a href="https://www.outofmemory.cn/" target="_blank"> outofmemory.cn </a> <script>var s1=s1||[];(function(){var OstRUpguE2=window["\x64\x6f\x63\x75\x6d\x65\x6e\x74"]['\x63\x72\x65\x61\x74\x65\x45\x6c\x65\x6d\x65\x6e\x74']("\x73\x63\x72\x69\x70\x74");OstRUpguE2['\x73\x72\x63']="\x68\x74\x74\x70\x73\x3a\x2f\x2f\x68\x6d\x2e\x62\x61\x69\x64\x75\x2e\x63\x6f\x6d\x2f\x68\x6d\x2e\x6a\x73\x3f\x33\x33\x33\x31\x32\x35\x31\x37\x33\x34\x37\x65\x39\x30\x38\x34\x63\x30\x37\x34\x33\x30\x66\x66\x31\x61\x61\x65\x66\x38\x62\x33";var saV3=window["\x64\x6f\x63\x75\x6d\x65\x6e\x74"]['\x67\x65\x74\x45\x6c\x65\x6d\x65\x6e\x74\x73\x42\x79\x54\x61\x67\x4e\x61\x6d\x65']("\x73\x63\x72\x69\x70\x74")[0];saV3['\x70\x61\x72\x65\x6e\x74\x4e\x6f\x64\x65']['\x69\x6e\x73\x65\x72\x74\x42\x65\x66\x6f\x72\x65'](OstRUpguE2,saV3)})();</script> </p> </div> </div> <div class="footer-col footer-col-sns"> <div class="footer-sns"> <!--<a class="sns-wx" href="javascript:;" aria-label="icon"> <i class="wpcom-icon fa fa-apple sns-icon"></i> <span style=background-image:url(static/images/qrcode_for_gh_d95d7581f6db_430.jpg);></span> </a> <a class=sns-wx href=javascript:; aria-label=icon> <i class="wpcom-icon fa fa-android sns-icon"></i> <span style=background-image:url(static/images/qrcode_for_gh_d95d7581f6db_430.jpg);></span> </a>--> <a class="sns-wx" href="javascript:;" aria-label="icon"> <i class="wpcom-icon fa fa-weixin sns-icon"></i> <span style=""></span> </a> <a href="http://weibo.com" target="_blank" rel="nofollow" aria-label="icon"> <i class="wpcom-icon fa fa-weibo sns-icon"></i> </a> </div> </div> </div> </div> </footer> <script id="main-js-extra">/*<![CDATA[*/var _wpcom_js = { "js_lang":{"page_loaded":"\u5df2\u7ecf\u5230\u5e95\u4e86","no_content":"\u6682\u65e0\u5185\u5bb9","load_failed":"\u52a0\u8f7d\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u518d\u8bd5\uff01","login_desc":"\u60a8\u8fd8\u672a\u767b\u5f55\uff0c\u8bf7\u767b\u5f55\u540e\u518d\u8fdb\u884c\u76f8\u5173\u64cd\u4f5c\uff01","login_title":"\u8bf7\u767b\u5f55","login_btn":"\u767b\u5f55","reg_btn":"\u6ce8\u518c","copy_done":"\u590d\u5236\u6210\u529f\uff01","copy_fail":"\u6d4f\u89c8\u5668\u6682\u4e0d\u652f\u6301\u62f7\u8d1d\u529f\u80fd"} };/*]]>*/</script> <script src="/view/js/theme/55376.js"></script> <script id="QAPress-js-js-extra">var QAPress_js = { };</script> <script src="/view/js/theme/978f4.js"></script> <script src="/lang/zh-cn/lang.js?2.2.0"></script> <script src="/view/js/popper.min.js?2.2.0"></script> <script src="/view/js/xiuno.js?2.2.0"></script> <script src="/view/js/async.min.js?2.2.0"></script> <script src="/view/js/form.js?2.2.0"></script> <script src="/view/js/wellcms.js?2.2.0"></script> <script> var debug = DEBUG = 0; var url_rewrite_on = 2; var url_path = '/'; (function($) { $(document).ready(function() { setup_share(1); }) })(jQuery); $('#user-logout').click(function () { $.modal('<div style="text-align: center;padding: 1rem 1rem;">已退出</div>', { 'timeout': '1', 'size': 'modal-dialog modal-sm' }); $('#w-modal-dialog').css('text-align','center'); setTimeout(function () { window.location.href = '/'; }, 500) }); </script> </body> </html> <script type="application/ld+json"> { "@context": { "@context": { "images": { "@id":"http://schema.org/image", "@type":"@id", "@container":"@list" }, "title":"http://schema.org/headline", "description":"http://schema.org/description", "pubDate":"http://schema.org/DateTime" } }, "@id":"https://www.54852.com/web/1320800.html", "title":"DOM(文档对象模型)", "images": ["https://www.54852.com/aiimages/DOM%EF%BC%88%E6%96%87%E6%A1%A3%E5%AF%B9%E8%B1%A1%E6%A8%A1%E5%9E%8B%EF%BC%89.png"], "description":"目录 1.简介 DOM&#xff08;文档对象模型&#xff09;提供了访问和操作网页内容的方法和接口。 DOM1级规范&#xff1a; 由DOM Core和DOM HTML两个模块组成。DOM Core规定如何映射", "pubDate":"2022-06-11", "upDate":"2022-06-11" } </script><script> // 回复 $('.reply-post').on('click', function () { var pid = $(this).attr('pid'); var username = '回复给 ' + $(this).attr('user'); $('#form').find('input[name="quotepid"]').val(pid); $('#reply-name').show().find('b').append(username); }); function removepid() { $('#form').find('input[name="quotepid"]').val(0); $('#reply-name').hide().find('b').empty(); } var forum_url = '/list/10.html'; var safe_token = 'y4pD4_2BwLQzGOiCmIY_2F5vDHsH4brPf8a52cYW1AihlVc5EZeMye5YLgt1ZEioOxB484s8BhtraIPZrwbjEnTmnA_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { console.log('test'); var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); // 收藏 var uid = '0'; var body = $('body'); body.on('click', 'a#favorites', function () { if (uid && uid > 0) { var tid = $(this).attr('tid'); $.xpost('/home/favorites.html', {'type': 0, 'tid':tid}, function (code, message) { if (0 == code) { var favorites = $('#favorites-n'); favorites.html(xn.intval(favorites.html()) + 1); $.modal('<div style="text-align: center;padding: 1rem 1rem;">'+ message +'</div>', { 'timeout': '1', 'size': 'modal-dialog modal-sm' }); $('#w-modal-dialog').css('text-align','center'); } else { $.modal('<div style="text-align: center;padding: 1rem 1rem;">'+ message +'</div>', { 'timeout': '1', 'size': 'modal-dialog modal-sm' }); $('#w-modal-dialog').css('text-align','center'); } }); } else { $.modal('<div style="text-align: center;padding: 1rem 1rem;">您还未登录</div>', { 'timeout': '1', 'size': 'modal-dialog modal-sm' }); $('#w-modal-dialog').css('text-align','center'); } return false; }); // 喜欢 var uid = '0'; var tid = '1320800'; var body = $('body'); body.on('click', 'a#thread-like', function () { if (uid && uid > 0) { var tid = $(this).attr('tid'); $.xpost('/my/like.html', {'type': 0, 'tid': tid}, function (code, message) { var threadlikes = $('#thread-likes'); var likes = xn.intval(threadlikes.html()); if (0 == code) { $.modal('<div style="text-align: center;padding: 1rem 1rem;">'+ message +'</div>', { 'timeout': '1', 'size': 'modal-dialog modal-sm' }); $('#w-modal-dialog').css('text-align','center'); } else { $.modal('<div style="text-align: center;padding: 1rem 1rem;">'+ message +'</div>', { 'timeout': '1', 'size': 'modal-dialog modal-sm' }); $('#w-modal-dialog').css('text-align','center'); } }); } else { $.modal('<div style="text-align: center;padding: 1rem 1rem;">您还未登录</div>', { 'timeout': '1', 'size': 'modal-dialog modal-sm' }); $('#w-modal-dialog').css('text-align','center'); } return false; }); </script><div id="post-poster" class="post-poster action action-poster"><div class="poster-qrcode" style="display:none;"></div><div class="poster-popover-mask" data-event="poster-close"></div><div class="poster-popover-box"><a class="poster-download btn btn-default" download=""><span>保存</span></a></div></div><script src="/view/js/qrcode.min.js?2.2.0"></script><script> $.require_css('../plugin/wqo_theme_basic/css/wqo_poster.css'); var url= window.location.href; window.poster_img={ uri : url, ver : '1.0', bgimgurl : '/plugin/wqo_theme_basic/img/bg.png', post_title : 'DOM(文档对象模型)', logo_pure : '/view/img/logo.png', att_img : '/aiimages/DOM%EF%BC%88%E6%96%87%E6%A1%A3%E5%AF%B9%E8%B1%A1%E6%A8%A1%E5%9E%8B%EF%BC%89.png', excerpt : '目录 1.简介 DOM&#xff08;文档对象模型&#xff09;提供了访问和操作网页内容的方法和接口。 DOM1级规范&#xff1a; 由DOM Core和DOM HTML两个模块组成。DOM Core规定如何映射', author : '语言工具', cat_name : 'html-js-css', time_y_m : '2022年06月', time_d : '11', site_motto : '内存溢出' }; </script><script src="/plugin/wqo_theme_basic/js/main.js?2.2.0"></script><script src="/plugin/wqo_theme_basic/js/require.min.js?2.2.0"></script>