Export (0) Print
Expand All
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

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">
console.log(document.links[2].href);
</script> 

 

 

Show:
© 2014 Microsoft