Mega Code Archive

 
Categories / JavaScript Tutorial / HTML Tags
 

Anchor text

Syntax document.anchors[num].text The text property contains the text that appears between the and tags. If other HTML tags appear within these two anchor tags, the text property might not contain all of the text between the anchor tags. <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>     A<br>     B<br>     A<br>     B<br>     A<br>     B<br>     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>     <hr><a name="C"><h4>The Letter C</h4></a>     F<br>     G<br>     <script language="JavaScript">     <!--     document.write("<hr>Pick a letter:<br>");     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>