XML DOM nodeName property
Definition and Usage
nodeName property returns the name of the node, depending on its type.
grammar
documentObject.nodeName
Examples
The following code fragment uses loadXMLDoc () to " the Books.xml " into xmlDoc, and displays the node name and node type of the root node:
Examples
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"
Try Demos
Displays the node name and node values for all elements
Document Object