document.anchors : anchors « Document « JavaScript Tutorial






Syntax

document.anchors
    document.anchors[index]

The anchors property is an array that contains all the Anchor objects.

The anchors property has a length property, which contains the number of Anchor objects in the array.

The index number ranges from zero to the length - 1.

<html>
    <a name="A"><h4>The Letter A</h4></a>
    A<br>
    B<hr>
    <a name="B"><h4>The Letter B</h4></a>
    C<br>
    D<br>
    E<hr>
    <script language="JavaScript">
    <!--
    document.write("Anchor Names:<br>");       //Title
    for(var x=0; x<=document.anchors.length; x++)
    {
      document.write(document.anchors[x].name,"<br>");
    }
    -->
    </script>
    </html>








14.4.anchors
14.4.1.document.anchors
14.4.2.document.anchors.length