Mega Code Archive

 
Categories / JavaScript DHTML / HTML
 

List the links in a page

/* Examples From JavaScript: The Definitive Guide, Fourth Edition Legal matters: these files were created by David Flanagan, and are Copyright (c) 2001 by David Flanagan.  You may use, study, modify, and distribute them for any purpose.  Please note that these examples are provided "as-is" and come with no warranty of any kind. David Flanagan */ /*  * FILE: listlinks.js  * List all links in the specified document in a new window.  */     function listlinks(d) {     var newwin = window.open("", "linklist",                      "menubar,scrollbars,resizable,width=600,height=300");     for (var i = 0; i < d.links.length; i++) {         newwin.document.write('<a href="' + d.links[i].href + '">')         newwin.document.write(d.links[i].href);         newwin.document.writeln("</a><br>");     }     newwin.document.close(); }