document.links

JavaScript 1.0+, JScript 1.0+ Nav2+, IE 3+, Opera3+ Syntax

document.links
document.links[index]

Description

The links property is an array that contains all the Link objects that appear within the HTML document from using the <a href=" source "> tag. The links property has one property of its own, called length, which contains the number of Link objects in the array. The index number ranges from zero to the length minus one. See Link, earlier in this chapter, for a detailed explanation of all the properties associated with links.

Warning

Although anchors are created using the <a> tag, they are not accessible through the links array. Anchors are stored in the document's anchors array.

Example

Listing 7.144 displays ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.