The DOMdocumentObjectModel, which describes a hierarchical number of nodes. D(document) is a Web document,O(object) is a window object, and so on, you can call its properties and methods;M(model) is the tree structure of a Web page document. The DOM defines the objects and attributes of the HTML element, and the way they are accessed, that is, the DOM can get, modify, add, and delete the HTML elements.
1.DOM node
The DOM treats the label as a node and understands the Web page as a node tree of nodes . There are five types of nodes : Document nodes , element nodes, text nodes, attribute nodes, annotations, and nodes. The entire document is a document node, each HTML element is an element node, the text inside the HTML element is a text node, each HTML attribute is an attribute node, and the comment is a comment node, which are all relatively easy to understand.
1) Node Properties
DOM nodes have several very useful properties:nodeName,nodetype,nodevalue.
The NodeName property specifies the name of the node, which always contains the uppercase tag name of the HTML element, the NodeValue attribute specifies the value of the node, the NodeType property returns the type of the node, and NodeType is read-only.
2) hierarchy Node Properties
The hierarchy of nodes can be divided into: parent node and child node, sibling node, when it gets to an element node, it can get other level nodes through the Hierarchy node property.
2. Node method for the convenience of operation, the group provides some properties and methods for locating nodes, through which the DOM can create, find, delete, and so on:
These methods make it easier to manipulate web elements.
"JavaScript" Dom summary