Use document.links collection : document « Javascript Objects « JavaScript DHTML






Use document.links collection

   
<html>
<head>
<title>Reference</title>
</head>
<body>
<a href="http://www.java2s.com">java2s.com</a>
<p>
<script type="text/javascript">
for (var i = 0; i < document.links.length; i++) {
  var link = document.links[i];
  document.writeln(link.title + " : " +  link.href + "<br />");
}
</script>
</p>
</body>
</html>

   
    
    
  








Related examples in the same category

1.'expando' Example
2.Active Element
3.Document 'URLUnencoded' Example
4.'URL' Example
5.Create a Comment
6.'write()' Example
7.'writeln()' Example
8.Execute Command
9.Document parentWindow
10.Document referrer
11.Document compatMode
12.Document design Mode
13.Document doctype
14.Document Domain
15.Document title Example
16.Document Link color
17.Print page out
18.Expose the prperties of Objects