Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] Opening an URL through a form


  • From: hassan at webtuitive.com (Hassan Schroeder)
  • Subject: [Javascript] Opening an URL through a form
  • Date: Sat May 3 17:09:51 2003

LJ wrote:

> I'd like to create a HTML form where the word entered in a text field
> will be added to the following url that will be opened on submit
> http://www.google.com/search?hl=sv&ie=UTF-8&oe=UTF-8&q=
> 
> I.e., if you enter "hello" in the text field submitting the form will
> open the url http://www.google.com/search?hl=sv&ie=UTF-8&oe=UTF-8&q=hello

You're in luck -- that's the way browsers work; a 'GET' request
has all form name/value pairs appended as a 'query string' :-)

<form method="get" action="http://www.google.com/search";>
<input type="hidden" name="hl" value="sv"/>
<input type="hidden" name="ie" value="UTF-8"/>
<input type="hidden" name="oe" value="UTF-8"/>
<input type="text" name="q"/>
<input type="submit"/>
</form>

In other words, the above form will do exactly what you describe.

HTH!
-- 
Hassan Schroeder ----------------------------- hassan@xxxxxxxxxxxxxx
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.