linksNN 2 IE 3 DOM 1  

  

A collection of all a and area elements that have assigned href attributes that make them behave as links (instead of only anchors). Collection members are sorted in source code order. Navigator and Internet Explorer let you use array notation to access a single link in the collection (document.links[0] or document.links["section3"], for example). If you wish to use the link's name as an index value (always as a string identifier), be sure to use the value of the name attribute, rather than the id attribute. To use the id attribute in a reference to an anchor, access the object via a document.all.elementID (in IE only) or document.getElementById("elementID") reference.

 
Object Model Reference
 
document.links
 
Object-Specific Properties
 
length
 
Object-Specific Methods
 
item( )namedItem( )tags( )urns( )
 
Object-Specific Event Handler Properties

None.

lengthNN 2 IE 3 DOM n/a  

Read-only  

Returns the number of elements in the collection.

 
Example
 
var howMany = document.links.length;
 
Value

Integer.

item( )NN 6 IE 4 DOM 1  

item(index) item(index[, subindex])

  

Returns a single object or collection of objects corresponding to the element matching the index value (or, optionally in IE/Windows, the index and subindex values).

 
Parameters
 
  • When the parameter is a zero-based integer (as required for Netscape 6), the returned value is a single element corresponding to the said numbered item in source code order (nested within the current element). When the parameter is a string (allowed by IE/Windows), the returned value is a collection of elements with id or name properties that match that string.
  • If you specify a string value for the first parameter (in IE/Windows), you may use the second parameter to specify a zero-based integer to retrieve a specific element from the collection with id or name properties that match the first parameter's string value.
 
Returned Value

One object or collection (array) of objects. If there are no matches to the parameters, the returned value is null.

namedItem( )NN 6 IE 6 DOM 1  

namedItem(IDOrName)

  

Returns a single object (in Netscape 6) or collection of objects corresponding to the element matching the parameter string value.

 
Parameters
 
IDOrName

The string that contains the same value as the desired element's id or name attribute.

 
Returned Value

One object (in Netscape 6) or collection (array) of objects. If there are no matches to the parameters, the returned value is null.

tags( )NN n/a IE 4 DOM n/a  

tags(tagName)

  

Returns a collection of objects (among all objects within the current collection) with tags that match the tagName parameter. Lets you distinguish among collections of a and area elements.

 
Parameters
 
  • A string that contains the element tag, as in document.links.tags("a").
 
Returned Value

A collection (array) of objects. If there are no matches to the parameters, the returned value is an array of zero length.

urns( )NN n/a IE 5(Win) DOM n/a  

urns(URN)

  

Returns a collection of nested element objects that have behaviors attached to them and URNs that match the URN parameter.

 
Parameters
 
  • A string with a local or external behavior file URN.
 
Returned Value

A collection (array) of objects. If there are no matches to the parameters, the returned value is an array of zero length.