Home >Web Front-end >JS Tutorial >Compilation of some information related to HTML node_javascript skills
1. HTML DOM is a tree object
2. Each node contains certain information about the node, namely:
1. nodeName
The nodeName attribute contains a certain The name of the node.
* The nodeName of the element node is the tag name
* The nodeName of the attribute node is the attribute name
* The nodeName of the text node is always #text
* The nodeName of the document node is always #document
Note: The tag name of the XML element contained in nodeName is always uppercase
2. nodeValue
For text nodes, the nodeValue attribute contains text.
For attribute nodes, the nodeValue attribute contains the attribute value.
The nodeValue attribute is not available for document nodes and element nodes.
3. nodeType
nodeType attribute can return the type of node.
The most important node types are:
Element type SPAN> | Node type SPAN> | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Element | 1 | ||||||||||||
Property | 2 | ||||||||||||
Text | 3 | ||||||||||||
Comments | 8 | ||||||||||||
Documentation | 9
|