Create Single Text Box With Two Output Buttons
Hey guys, I'm trying to create a single text box which will output to two different actions.
If you go here: http://stevenford.atspace.com/test.html you can see, I'm trying to combine Wikipedia and Google together, so one text input, then two search buttons. Anyway, I came across this bit of code, that seems to do it:
<form method="get" action="http://www.google.ca/search">
<input name="q" size="63">
<input type="submit" value="Google Search" />
<input type="submit" value="Image Search" onclick="this.form.action='http://images.google.com/images';" />
However, the problem is, for this to work, the input box must have the same name on both forms. Here it's "q", and that's fine, because both Google and image search have "q". However, Wikipedia has "search". Is it still possible to combine them together?
Thanks a lot guys.
<form method="get" action="http://www.google.ca/search" onsubmit="this.form.search.value = this.form.q.value; return true;">
<input type="hidden" name="search">
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)