document.anchors

JavaScript 1.2+, JScript 3.0+ Nav4+, IE 4+ Syntax

document.anchors
document.anchors[index]

Description

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

Warning

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

Example ...

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.