all
alt
ch
dir
id
min
rel
top
url
URL
urn
Expand Minimize

links property

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

Syntax

JavaScript

p = object.links

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:
© 2014 Microsoft. All rights reserved.