How can I cancel the keydown of a button on the keyboard in an HTML开发者_开发技巧 page.
Thanks
It's somewhat more complicated than described so far, see Quirksmode.org:
You cannot prevent the default
onkeydown
in Opera.
In Opera, use onkeypress
instead.
Handle the onkeydown
event and return false;
Try this
<input type="button" onkeydown="return false;" />
精彩评论