ZVON > References > DOM2 Reference

getElementsByName (method )

Owning interface and usage:  
HTMLDocument.getElementsByName(elementName)

Member of these other interfaces:  
none

Description:  
With HTML documents, this method returns the (possibly empty) collection of elements whose name value is given by elementName. In XHTML documents, this methods only return the (possibly empty) collection of form controls with matching name. This method is case sensitive.

Parameters:  
DOMString elementName  -  The name attribute value for an element.

Returns:  
NodeList -  The matching elements.

Exceptions:  
none


Example:
JavaScript:
  function getElementsByNameInDocument() {
    var collection = document.getElementsByName('link');
    alert( 'Number of LINK elements in this document: ' + collection.length );
  }
Try it:  
See it: