TOC PREV NEXT INDEX

domref



getElementsByTagName


Returns a list of the child elements of a given name on the current element.

Syntax

elements = element.getElementsByTagName(Name)
 

Parameters

elements is a nodeList of elements.

tagName is a string representing the name of the elements.

Example

// check the alignment on a number of cells in a table.
 
table = document.getElementById("forecast-table");
 
cells = table.getElementsByTagName("td");
 
for (var i = 0; i < cells.length; i++) {
 
    status = cells[i].getAttribute("status");
 
    if ( status == "open") {
 
        // grab the data
 
    }
 
}
 

 

Notes

getElementsByTagName on the element is the same as getElementsByTagName on the document, except that its search is restricted to those elements which are children of the current element.

Specification

getElementsByTagName
 


Netscape Communications
http://developer.netscape.com
TOC PREV NEXT INDEX