Home > Web Front-end > JS Tutorial > body text

Introduction to nodeType value of HTML DOM_javascript skills

WBOY
Release: 2016-05-16 18:08:55
Original
1114 people have browsed it

nodeName, nodeValue and nodeType contain information about the node.

The nodeName attribute contains the name of a 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 by nodeName is always uppercase

nodeValue
For text nodes, the nodeValue attribute contains the text.
For attribute nodes, the nodeValue attribute contains the attribute value.
The nodeValue attribute is not available for document nodes and element nodes.
nodeType The
nodeType attribute returns the type of node.
The most important node types are:

元素类型 节点类型
元素element 1
属性attr 2
文本text 3
注释comments 8
文档document 9
Added:
Value-Element Type
1-ELEMENT
2-ATTRIBUTE
3-TEXT
4-CDATA
5-ENTITY REFERENCE
6-ENTITY
7-PI (processing instruction)
8-COMMENT
9-DOCUMENT
10-DOCUMENT TYPE
11-DOCUMENT FRAGMENT
12-NOTATION


HTML file:
Copy code The code is as follows:





DOM standard
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template