+ Reply to Thread
Results 1 to 5 of 5

Link Extractor

This is a discussion on Link Extractor within the PHP, ASP, JavaScript, Etc. / Programmers: forums, part of the Web Project Requests: category; Some code that will extract all the links on the page and put them into a new document <script language="JavaScript1.2"> ...

  1. #1
    New Hunter dandaman is on a distinguished road
    Join Date
    Mar 2007
    Posts
    3

    Default Link Extractor

    Some code that will extract all the links on the page and put them into a new document

    <script language="JavaScript1.2">
    function extractlinks(){if (document.all||document.getElementById){
    if (document.all)
    var links=document.all.tags("A")
    else if (document.getElementById)
    var links=document.getElementsByTagName("A")
    var total=links.length
    var win2=window.open("","","menubar,scrollbars,status" )
    win2.document.write("<h2>Total Links="+total+"</h2><br>")
    for (i=0;i<total;i++){
    win2.document.write('<a href="'+links[i]+'">'+links[i].innerHTML+'</a><br>')}win2.document.close()}}
    </script>
    <button onClick="extractlinks()">Extract Links</button>

  2. #2
    Banned mntor has a spectacular aura about mntor has a spectacular aura about mntor has a spectacular aura about
    Join Date
    Aug 2007
    Posts
    109

    Default

    Quote Originally Posted by dandaman View Post
    Some code that will extract all the links on the page and put them into a new document
    Thanks for sharing. It is cool one for all the web programmers.

  3. #3
    Field Master Arch3r25 is on a distinguished road
    Join Date
    Jul 2007
    Posts
    120

    Default

    Yeah, this is useful.

    An even better script would be one that takes all the images from a webpage and lists them...nice.

  4. #4
    Field Master karthikeyan is on a distinguished road karthikeyan's Avatar
    Join Date
    Jun 2007
    Posts
    216

    Default

    This one is useful thanks for sharing !

  5. #5
    New Hunter tedj is on a distinguished road
    Join Date
    Sep 2008
    Posts
    1

    Default How do I run this script? new to java

    I have web page & I want to run the script. What do I need to do?

    thanks
    tj

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts