<html> <head> <title>Get all links on a page</title> </head> <body> <h1>Get all links on a page</h1> <P> <a href="http://www.java2s.com/">Example</a><br /> <a href="http://www.java2s.com/">Example</a><br /> <a href="http://www.java2s.com/">Example</a><br /> <a href="http://www.java2s.com/">Example</a><br /> <a href="http://www.java2s.com/">Example</a><br /> <a href="http://www.java2s.com/">Example</a><br /> </p> <script language="javascript" type="text/javascript"> <!-- var allLinks = document.links; for (var i=0; i<allLinks.length; i++) { document.write(allLinks[i].href+"<BR/>"); } //--> </script> </body> </html>