try:
<script type = "text/javascript">
function handleEnter(evt)
{
evt = (evt) ? evt : event;
var form = (evt.target) ? evt.target : evt.srcElement;
var charCode = (evt.charCode) ? evt.charCode :
((evt.which) ? evt.which : evt.keyCode);
if (charCode == 13) {
setAction1(form)
form.submit();
return false;
}
return true;
}
function setAction1(f) {
var actionVal;
if (f.rad1[0].checked)
{
actionVal = "results_serial2.asp?search=";
}
else if (f.rad1[1].checked)
{
actionVal = "results_client2.asp?search=";
}
f.action = actionVal;
}
</script>
<p align="left"><a href="../search2.asp"><img src="../Images/buttons/search.jpg" width="157" height="65" border="0" align="top" /></a> </p>
<p align="left">
<form action="" method="get" name = "myForm" id="myForm" onkeypress="handleEnter(event)">
<input name="search" type="text" class="body_search_box" id="search" size="20" maxlength="25" />
</p>
<p align="left">
<input type="radio" name="rad1" value="serial_code" checked="checked" />
<span class="search_option">Serial
<input type="radio" name="rad1" value="client" />
Client</span></p>
<p align="left">
<input name="Submit" type="submit" class="button_big" onclick = "setAction1()" value="Search" />
</p>
</form>
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46:





by: garreHPosted on 2008-09-08 at 13:58:26ID: 22421560
Hi LZ1
The form has to have focus so when you hit enter it submits the form i.e. you press enter while your typing cursor is in the search box. When I tested it in firefox and ie, it worked for me as expected. Did you want it to redirect when you click on a radio button?