The code for an internet search thing looks like this
Code:
The form looks like this
Code:
People have a bad habit of just hitting enter instead of the button. Is there any way to make the enter button run the search function? Right now, hitting enter just refreshes the page.
Code:
function search()
{
var searchArg;
searchArg = document.searchform.searchterm.value;
if(document.searchform.chooseEngine.value=="google")
window.location="http://www.google.com/search?hl=en&q=" + searchArg + "&btnG=Google+Search";
The form looks like this
Code:
<form name="searchform">
<select NAME="chooseEngine">
<option VALUE="google" SELECTED> Google.com
</select>
<br><input type="text" name="searchterm"><br>
<input type="button" value = "Search" onClick="search()">
</form>
People have a bad habit of just hitting enter instead of the button. Is there any way to make the enter button run the search function? Right now, hitting enter just refreshes the page.