homepage Welcome to WebmasterWorld Guest from 54.161.175.231
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
input field value into link query string..
jebster




msg:1476728
 9:24 am on Jun 1, 2003 (gmt 0)

How would I take the value of a input field and put it into a links query string? Like google does when you have already typed a search term in the box then click on the "Image Search" link and such. Thanks

 

RonPK




msg:1476729
 9:47 am on Jun 1, 2003 (gmt 0)

Not sure I understand what you mean...
On one page you have an input field and a hyperlink, and you want to add the user's input as a querystring to the hyperlinks href-part?

What Google does is simply what every webserver does when a form is posted (using method=get) to the server.

jebster




msg:1476730
 10:29 am on Jun 1, 2003 (gmt 0)

No not like that, go to googles main page and type in a search term but DON'T hit search, then hit the image search button and it will take the search term with to the image search page! :)

dmorison




msg:1476731
 10:35 am on Jun 1, 2003 (gmt 0)

Hi Jebster,

The easiest way for you to copy what Google does is to have a look at the source code for their site.

I just had a look, and what it actually does is use Javascript to submit the search form to the Image search page when you click on the Image link - so it is not strictly a link, it is more like a submit button.

The value of "q" (the input field) is then used by the Image page just as any page uses a form variable received via a GET operation.

jebster




msg:1476732
 10:55 am on Jun 1, 2003 (gmt 0)

Is that allowed tho? Without their permission? Isn't that like stealing their code?

dmorison




msg:1476733
 11:02 am on Jun 1, 2003 (gmt 0)

I'm not saying copy Google's JavaScript code letter for letter - it wouldn't work anyway unless you name everything on your site the same way.

All i'm saying is just look at how Google do it, see what HTML events and Javascript functions are used to achive the effect and then roll your own code.

jebster




msg:1476734
 11:17 am on Jun 1, 2003 (gmt 0)

Ok, thanks for the help! :)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved