document.anchors.length : anchors « Document « JavaScript Tutorial






Syntax

document.anchors.length

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

<html>
    <hr><a name="Trumpet"><h4>Trumpet</h4></a>
    A<br>
    <hr><a name="Guitar"><h4>Guitar</h4></a>
    B<br>
    <hr><a name="Piano"><h4>Piano</h4></a>
    C<br>
    <script language="JavaScript">
    <!--
    for(var counter=0; counter<=document.anchors.length; counter++)
    {
      document.write("<a href='#",document.anchors[counter].name,"'>");
      document.write(document.anchors[counter].text,"</a><br>");
    }

    -->
    </script>
    </html>








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