Mega Code Archive

 
Categories / JavaScript Tutorial / Document
 

Document links

Syntax document.links     document.links[index] The links property is an array that contains all the Link objects. The links property length contains the number of Link objects in the array. The index number ranges from zero to the length minus one. Although anchors are created using the tag, they are not accessible through the links array. Anchors are stored in the document's anchors array. <html>     <a href="http://www.rntsoft.com">B Page</a><br>     <a href="http://www.rntsoft.com">A Page</a><br>     <script language="JavaScript">     <!--     for(i=0;i<document.links.length;i++)     {       document.write("The URL of link object ",(i+1));       document.write(" is <i><b>",document.links[i].href,"</b></i><br>");     }     -->     </script>     </html>