[Javascript] Check which key was pressed
Dan.Marzolini at xansa.com
Dan.Marzolini at xansa.com
Tue Dec 11 09:07:37 CST 2001
Add an onkeypress event eg. <input type="text" .. onkeypress="return
goReturn()">
and use the following function
function goReturn() {
getEvent=event.keyCode;
if (getEvent == "13") {
document.forms[0].submit();
return false;
} else {
return true;
}
}
which will submit the form when the return key is pressen (code 13) and also
stop the beeps...
hope this helps
ps - if you're using this for netscape you'll need to modify the event.keycode bit
More information about the Javascript
mailing list