anchorsNN 2 IE 3 DOM 1  

  

A collection of all a elements with assigned name attributes that make them behave as anchors (instead of links). Collection members are sorted in source code order. Navigator and Internet Explorer let you use array notation to access a single anchor in the collection (e.g., document.anchors[0], document.anchors["section3"]). Internet Explorer 4 also allows the index value to be placed inside parentheses instead of brackets (e.g., document.anchors(0)). If you want to use the anchor'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.anchors
 
Object-Specific Properties
 
length
 
Object-Specific Methods
 
item( )namedItem( )tags( )urns( )
 
Object-Specific Event Handler Properties

None.

lengthNN 2 IE 3 DOM 1  

Read-only  

Returns the number of elements in the collection.

 
Example
 
var howMany = document.anchors.length;
 
Value

Integer.

item( )NN 6 IE 4 DOM 1  

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

  

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

 
Parameters
 
index

When the parameter is a zero-based integer (required in Netscape 6), the returned value is a single element that corresponds to the specified item in source code order (nested within the current element). When the parameter is a string, the returned value is a collection of elements whose id or name properties match that string.

 
Returned Value

One anchor object or collection (array) of anchor 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 anchor object or collection of anchor 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 anchor object or collection (array) of anchor 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 nested within the current collection) with tags that match the tagName parameter. Implemented in all IE collections (see the all.tags( ) method), but redundant for collections of the same element type.

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

urns(URN)

  

See the all.urns( ) method.