[thelist] Cancelling onKeyDown in Netscape 6
Matt Feldman
mfeldman at wwwood.net
Sun Nov 18 20:07:41 CST 2001
I'm trying to stop a form from submitting when the user presses enter on
a text field. In IE 5 and Netscape 4, I have a working solution: in the
onKeyDown attribute I call this function:
function cancelEnter(evt) {
if (evt.keyCode == 13) {
return false;
}
}
I have to replace the evt.keyCode with evt.which in Netscape 4, but
that's not a problem. In Netscape 6, however, it catches the event
fine, but returning false does not cancel the form submit. I know this
has something to do with event bubbling, but I don't know enough about
it to solve the problem.
Any suggestions?
-Matt
More information about the thelist
mailing list