TOC PREV NEXT INDEX

Put your logo here!


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 = cell.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

core


mozilla.org | mailto:oeschger | bug 93108
TOC PREV NEXT INDEX