rav
08-26-2003, 08:49 AM
I have a few select options and a few input buttons. What I want to have is the searchGoNow function to execute when "Enter" is pressed and the user is Focused on the form.
Here's what I have:
<select id="dropdown1" name="dropdown">
<option value="http://142.70.4.58/bluebook/searchresult.asp?search=&name=" selected >Blue Book</option>
<option value="http://intraapps.noranda.com/phone_book/search_results.asp?search=&name=" >Falconbridge Phonebook</option>
<option value="http://www.google.com/search?q=" >Google</option>
<option value="http://search.yahoo.com/bin/search?p=">Yahoo</option>
<option value="http://search.excite.com/search.gw?search=">Excite</option>
</select>
<input id="criteria" name="criteria">
<input type="button" value="Go" id="submit1" name="submit1" onclick="searchGoNow(dropdown.value,criteria.value);">
<SCRIPT LANGUAGE=javascript>
<!--
function searchGoNow(url,criteria)
{
if (criteria == "")
alert ("Please enter your search criteria and try again!!");
else
{
window.open(url + criteria, 'Search')
}
return false;
}
-->
</SCRIPT>
Here's what I have:
<select id="dropdown1" name="dropdown">
<option value="http://142.70.4.58/bluebook/searchresult.asp?search=&name=" selected >Blue Book</option>
<option value="http://intraapps.noranda.com/phone_book/search_results.asp?search=&name=" >Falconbridge Phonebook</option>
<option value="http://www.google.com/search?q=" >Google</option>
<option value="http://search.yahoo.com/bin/search?p=">Yahoo</option>
<option value="http://search.excite.com/search.gw?search=">Excite</option>
</select>
<input id="criteria" name="criteria">
<input type="button" value="Go" id="submit1" name="submit1" onclick="searchGoNow(dropdown.value,criteria.value);">
<SCRIPT LANGUAGE=javascript>
<!--
function searchGoNow(url,criteria)
{
if (criteria == "")
alert ("Please enter your search criteria and try again!!");
else
{
window.open(url + criteria, 'Search')
}
return false;
}
-->
</SCRIPT>