XML DOM length Property
NamedNodeMap object
Definition and Usage
The length property returns the number of nodes in a NamedNodeMap.
Syntax
nodemapObject.length
Example
The following code snippet uses loadXMLDoc() to load "books.xml" Load into xmlDoc, and get the value of the "category" attribute of the first
Example
xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.getElementsByTagName('book');
document.write(x.item(0).attributes.length);
The code above will output:
1
Try it »
Try it
length - Returns the number of nodes in a node list
length - Loop through the nodes in a NodeList
NamedNodeMap object