Home > Web Front-end > HTML Tutorial > Introduction to HTML DOM nodes (nodeName, nodeValue, nodeType)_html/css_WEB-ITnose

Introduction to HTML DOM nodes (nodeName, nodeValue, nodeType)_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:07:41
Original
1193 people have browsed it

For beginners, the functions and values ​​of the three attributes nodeName, nodeValue and nodeType in HTML DOM are not very clear. The information compiled below contains detailed information about the nodes for reference.

Node information

 Each node has attributes that contain some information about the node. These properties are:

nodeName (node ​​name) nodeValue (node ​​value) nodeType (node ​​type)

nodeName

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 in 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:

元素类型 节点类型
元素 1
属性 2
文本 3
注释 8
文档 9

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template