HTML DOM anchors collection
Document Object
Definition and Usage
The anchors collection returns an array of all hyperlinks on the current page.
Syntax
document.anchors[].
property
Browser support





All major browsers support the anchors collection
Example
Example 1
Returns the number of links in the document:
Number of anchors:
The example above produces the following output:
Number of anchors: 3
Try it »
Example 2
Returns the anchor text of the first hyperlink in the document:
First anchor in the document:
The example above produces the following output:
First anchor in the document: HTML Tutorial
Try it »
Document Object