Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何取消 HTML 页面中键盘上按钮的按键按下。
谢谢
处理onkeydown事件和return false;
onkeydown
return false;
尝试这个
<input type="button" onkeydown="return false;" />
它比目前描述的要复杂一些,请参阅Quirksmode.org:
您无法阻止onkeydownOpera 中的默认设置。
在 Opera 中,请onkeypress改用。
onkeypress