links property
Retrieves a collection of all a objects that specify the href property and all area objects in the document.
Syntax
| JavaScript | |
|---|
Property values
Type: IHTMLElementCollection
Array of a objects.
Standards information
There are no standards that apply here.
Remarks
For a objects to appear in the collection, they must have an href attribute.
Examples
This example shows how to display the href of the third link (Microsoft.com) defined in the document.
<a href="http://yahoo.com">Yahoo.com</a> <a href="http://msn.com">MSN.com</a> <a href="http://microsoft.com">Microsoft.com</a> <script type="text/javascript"> alert(document.links[2].href); </script>
Show: