links Collection | Internet Development Index |
Retrieves a collection of all a objects that specify the HREF property and all area objects in the document.
Syntax
[ oColl = ] document.links [ oObject = ] document.links(iIndex)
Possible Values
oColl Array of a objects. oObject Reference to an individual item in the array of elements contained by the object. iIndex Required. Integer that specifies the zero-based index of the item to be returned.
Members Table
The following table lists the members exposed by the links object. Click a tab on the left to choose the type of member you want to view.
Attributes/Properties
Property Description length Sets or retrieves the number of objects in a collection. Methods
Method Description item Retrieves an object from the all collection or various other collections. namedItem Retrieves an object or a collection from the specified collection. tags Retrieves a collection of objects that have the specified HTML tag name. urns Retrieves a collection of all objects to which a specified behavior is attached.
Remarks
For a objects to appear in the collection, they must have a name and/or id property.
Example
This example shows how to display the HREF attribute of the third link defined in the document.
alert(document.links(2).href);
Standards Information
This collection is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 .
Applies To
document