XML DOM nodeTypeProperty
Document object
Definition and Usage
The nodeType property returns the node type of a node.
Syntax
documentObject.nodeType
In all instances, we use XML filesbooks.xmland JavaScript functionsloadXMLDoc()。
Example
The following code snippet displays the node name and node type of the root node:
Example
xmlDoc=loadXMLDoc("books.xml");
document.write("Nodename: " + xmlDoc.nodeName);
document.write(" (nodetype: " + xmlDoc.nodeType);
document.write("Nodename: " + xmlDoc.nodeName);
document.write(" (nodetype: " + xmlDoc.nodeType);
Output:
Nodename: #document (nodetype: 9)
Try it Yourself »
Document objectother extensions