Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Dec 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    java to click a link

    javascript****

    so so basically what i wana do is is preform a search in google... easy enough, thats working. what i need to do is to have the last searched link on the page be submited to display via javascript.

    essentially what i am doing is creating a "reverse" im feeling lucky button.

    i have no clue how to do this, im new to java, however, i was discussing with a friend the possibility of omiting results that started with http://google and searching from the bottom up to obtain the last result?

    anyone who was any input on how to get this to work would be appreciated

    thanks

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,732
    Thanks
    202
    Thanked 2,508 Times in 2,486 Posts
    1) This is the JavaScript forum. Java and Javascript are entirely different programming languages, in spite of the confusingly similar names.

    2) What you are asking for is not possible using Javascript which cannot communicate with the server.

  • #3
    New to the CF scene
    Join Date
    Dec 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    what i was sorta messing with was something like this


    it
    will work for the google search I expect.


    document.write('<script type="text/javascript"><!--\n'); document.write('function selectLast(doc) {\n');
    document.write(' var links = doc.getElementsByClassName("l");\n');
    document.write(' var e = links[links.length-1];\n');
    document.write(' return true;\n');
    document.write('}\n');
    document.write('</script>\n');

    What this function aims to do is retrieve all elements within the document that belong to the class 'l' which is the result class for google links.


  •  

    Posting Permissions

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