What is the DOM?
With JavaScript you can restructure an entire HTML document. You can add, remove, change, or reorder items on a page.
To change anything on a page, JavaScript needs access to all elements in the HTML document. This access, along with methods and properties to add, move, change, or remove HTML elements, is given through the Document Object Model (DOM).
In 1998, W3C published the Level 1 DOM specification. This specification allowed access to and manipulation of every single element in an HTML page.
All browsers have implemented this recommendation, and therefore, incompatibility problems in the DOM have almost disappeared.
The DOM can be used by JavaScript to read and change HTML, XHTML, and XML documents.
The DOM is separated into different parts (Core, XML, and HTML) and different levels (DOM Level 1/2/3):
- Core DOM - defines a standard set of objects for any structured document
- XML DOM - defines a standard set of objects for XML documents
- HTML DOM - defines a standard set of objects for HTML documents
Everything in an HTML document is a node.
Nodes
According to the DOM, everything in an HTML document is a node.
The DOM says that:
- The entire document is a document node
- Every HTML tag is an element node
- The texts contained in the HTML elements are text nodes
- Every HTML attribute is an attribute node
- Comments are comment nodes
Node Hierarchy
Nodes have a hierarchical relationship to each other.
All nodes in an HTML document form a document tree (or node tree). The tree starts at the document node and continues to branch out until it has reached all text nodes at the lowest level of the tree.
The following figure represents a document tree (node tree):
分享到:
相关推荐
王兴魁老师,AJAX视频(Netbeans)DOM基础及DOM操作HTML
JvavScript之dom基础(源代码)JvavScript之dom基础(源代码)JvavScript之dom基础(源代码)JvavScript之dom基础(源代码)JvavScript之dom基础(源代码)JvavScript之dom基础(源代码)JvavScript之dom基础(源...
DOM基础(ppt).pdf
DOM 首页 DOM 简介 DOM 节点 DOM 节点树 DOM 节点访问 DOM 节点信息 DOM How To DOM 参考 DOM 总结 DOM 实例 DOM 实例 DOM 对象 DOM Window DOM Navigator DOM Screen DOM History DOM Location DOM ...
DOM基础
XML&DOM基础教程.CHM
免费资源,xml和dom基础,xml和dom都是学习Ajax必读知识,爱好者都来下载吧。
dom基础_day3.zip
DOM基础和基本API.txtDOM基础和基本API.txt
DOM基础及php读取xml内容操作的方法_.docx
html 基础学习 关于dom对象的运用和教程 详细代码
主要介绍了JavaScript学习笔记之DOM基础操作,结合实例形式总结分析了javascript针对dom元素节点、属性的相关获取、设置等操作技巧,需要的朋友可以参考下
讲述了dom的一些基础知识
详细介绍 javascript的DOM对象模型
详细介绍了DOM的基础及其高级DOM技术,有实例,word版,可以打印,20页。。。。。
JavaScript课件PPT,JS教学资料,JS学习素材
dom4j 目录的介绍: 1)docs 是文档目录 2)如何查 Dom4j 的文档 3)Dom4j 快速入门 2)lib 目录 ...第三方的解析: jdom 在 dom 基础上进行了封装、 dom4j 又对 jdom 进行了封装。 pull 主要用在 And
主要介绍了DOM基础教程之使用DOM控制表单的相关资料,需要的朋友可以参考下
主要介绍了DOM基础教程之使用DOM设置文本框的相关资料,需要的朋友可以参考下