Welcome to WebmasterWorld Guest from 23.20.241.155

Forum Moderators: open

Message Too Old, No Replies

input field value into link query string..

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

10+ Year Member



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
9:47 am on Jun 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



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.

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

10+ Year Member



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! :)
10:35 am on Jun 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



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.

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

10+ Year Member



Is that allowed tho? Without their permission? Isn't that like stealing their code?
11:02 am on Jun 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



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.

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

10+ Year Member



Ok, thanks for the help! :)
 

Featured Threads

Hot Threads This Week

Hot Threads This Month