links Collection

Internet Development Index

Retrieves a collection of all a objects that specify the HREF property and all area objects in the document.


[ oColl = ] document.links
[ oObject = ] document.links(iIndex)

Possible Values

oCollArray of a objects.
oObjectReference to an individual item in the array of elements contained by the object.
iIndexRequired. Integer that specifies the zero-based index of the item to be returned.

Members Table

length Sets or retrieves the number of objects in a collection.
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.


For a objects to appear in the collection, they must have a name and/or id property.


This example shows how to display the HREF attribute of the third link defined in the document.


Standards Information

This collection is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 Non-Microsoft link.

Applies To