ZVON > References > DOM2 Reference

getElementsByTagName (method )

Owning interface and usage:  
Document.getElementsByTagName(tagName)

Member of these other interfaces:  
none

Description:  
Returns a NodeList containing all Elements of the given name in the same order as they appear in the source document.

Parameters:  
DOMString tagName  -  The name of the tag to match on. The special value "*" matches all tags.

Returns:  
NodeList -  A new NodeList object containing all the matched Elements.

Exceptions:  
none


Example:
Text in the first DIV.
Some text in the second DIV.
Some text and element in the third DIV.
We can try another elements. It will be much more interesting.
Text in the last DIV.
Source:
   <div id="doc">
     <div>
       Text in the first DIV.
     </div>
     <div id="DDD" class="secondClass">
       Some text in the second DIV.
     </div>
     <div class="thirdClass">
       Some text and <span id="SSS">element</span> in the third DIV.
     </div>
     <div class="fourthClass">
       We can try <i>another elements</i>.
       It will be much more <b>interesting</b>.
     </div>
     <div>
       Text in the last DIV.
     </div>
   </div>
     
JavaScript:
  var collection = document.getElementsByTagName('LINK');
  var output = collection[1].getAttribute('rel');
Output:
desired your browser
stylesheet