How do I cancel a key press in an input box in NS6 -- I can't get preventDefault() to work?
Apr 6th, 2008 19:34
ha mo, Dave Clark, Colin Fraser, Jim Fuqua,
You cannot cancel a keystroke, that is a very difficult thing to even
attempt, but what you can do is to trap the keystrokes as they are
see of they correspond to a pre-determined list of acceptable
keystrokes. If it does not, then just refuse to process it.
There are a number of querstions answered in this forum that provide an
answer to how that is done. Find one and adapt it to your need. (BTW, I
wrote several of them, and I know they all work.)
I don't have NS6 anymore to test with, but I'm pretty sure
cancelling a keystroke works in NS6 the same as in IE -- which is
through the use of the onkeydown event. Just return a false value to
that event, from the event handler, when an invalid keystroke is