开发者

Cancel the keydown in an HTML page?

开发者 https://www.devze.com 2023-01-03 13:41 出处:网络
How can I cancel the keydown of a button on the keyboard in an HTML开发者_开发技巧 page. ThanksIt\'s somewhat more complicated than described so far, see Quirksmode.org:

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;" />
0

精彩评论

暂无评论...
验证码 换一张
取 消