document.anchors.length

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

document.anchors.length

Description

The length property contains the number of Anchor objects that are in the document.

Example

Listing 7.54 uses the anchor length property to loop through all the anchors in the document. During each pass through the loop, a link to each anchor in the document is created.

Listing 7.54 Using the Anchor length Property to Create Hyperlinks
 <html> <center><h1><u>The Music Intrument Page</u></h1></center> <hr><a name="Trumpet"><h4>Trumpet</h4></a> The trumpet is a brass instrument that can create bright, loud tones. The horn has 3 valves for changing the tone being played.<br> <hr><a name="Guitar"><h4>Guitar</h4></a> The guitar is ...

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.