Extract links from a webpage


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function DoPrintLinks()
  2. {
  3.  
  4. var nCount = 0;
  5. var nEnd = document.links.length;
  6. var outpt="According to JavaScript, this document has "+nEnd+ " link(s) in it.<br>"
  7. for (nCount = 0 ; nCount < nEnd ; nCount ++){
  8. outpt+=document.links[nCount].href + "<br>"
  9. }
  10. document.write(outpt)
  11. }

URL: http://www.webdeveloper.com/forum/showthread.php?t=65477

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.