Latest web development tutorials

XML DOM value property

Attr Object Reference Attr objects

Definition and Usage

value property returns the value of the property.

grammar

attrObject.value


Examples

The following code fragment uses loadXMLDoc () to " the Books.xml " into xmlDoc, and displays the name and value of the category attribute:

Examples

xmlDoc=loadXMLDoc("books.xml");

x=xmlDoc.getElementsByTagName('book');

for(i=0;i<x.length;i++)
{
document.write(x.item(i).attributes[0].name);
document.write(" = ");
document.write(x.item(i).attributes[0].value);
document.write("
");
}

Output:

category = COOKING
category = CHILDREN
category = WEB
category = WEB

try it"

Attr Object Reference Attr objects