Latest web development tutorials

XML DOM nodeName property

Document Object Reference Document Object

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);

Output:

Nodename: #document (nodetype: 9)

try it"

Try Demos

Displays the node name and node values for all elements


Document Object Reference Document Object