XML DOM nodeValue Property

Document Object Reference Manual

Definition and Usage

The nodeValue property can be set or returned according to the type of the node.

Syntax:

documentObject.nodeValue

Example

In all examples, we will use the XML file books.xml, as well as the JavaScript function loadXMLDoc().

The following code snippet can display the node name and node value of the root node:

xmlDoc=loadXMLDoc("books.xml");
document.write("Nodename: ")
document.write(" (value: ") xmlDoc.childNodes[0].nodeValue);

Output:

Nodename: #document (value: version="1.0" encoding="ISO-8859-1"

Document Object Reference Manual