Anchor.name : Anchor : HTML Tags JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » HTML Tags » Anchor »

 

Anchor.name










Syntax








document.anchors[num].name



The name property holds the name of the anchor and is the way hyperlinks reference the anchor's position. This property is originally set by the NAME attribute in the

The following example accesses the name Property of the Anchor Object.












<html>
    <a href="#A">A</a>|<a href="#B">B</a>|<a href="#C">C</a>
    <hr><a name="A"><h4>The Letter A</h4></a>
    A<br>
    B<br>
    <hr><a name="B"><h4>The Letter B</h4></a>
    C<br>
    D<br>
    E<br>
    C<br>
    D<br>
    E<br>
    C<br>
    D<br>
    E<br>
    C<br>
    D<br>
    E<br>
    C<br>
    D<br>
    E<br>
    C<br>
    D<br>
    E<br>
    C<br>
    D<br>
    E<br>
    C<br>
    D<br>
    E<br>
    <hr><a name="C"><h4>The Letter C</h4></a>
    F<br>
    G<br>
    <script language="JavaScript">
    <!--
    document.write("<hr>Pick a letter:");
    for(var counter=0; counter<=document.anchors.length; counter++)
    {
      document.write("<a href='#",document.anchors[counter].name,"'>");

      document.write(document.anchors[counter].name,"</a>|");
    }
    -->
    </script>
    </html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo HTML Tags
» Anchor