XML DOM getElementsByTagName() Method
Complete Document Object Reference
Definition and Usage
The getElementsByTagName() method returns a NodeList of all a elements with a specified name.
Syntax
| getElementsByTagName(name)
|
| Parameter |
Description |
| name |
A string that specifies the tagname to search for. The
value "*" matches all tags |
Example
The following code fragment loads "books.xml"
into xmlDoc using
loadXMLDoc() and displays the value of the first <title> element:
Example
xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.getElementsByTagName("title")[0]
y=x.childNodes[0];
document.write(y.nodeValue);
|
Output:
Try it yourself »
|
Complete Document Object Reference
Click here to design a Stunning Flash Website for Free
Wix is a revolutionary web design tool that provides anyone with the possibility to create professional and beautiful websites for free.
With e-commerce features, search engine visibility and many more professional tools, Wix is the ultimate solution for creating a spectacular site while saving tons of money.
|