且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用 JavaScript 和 jQuery,跨浏览器处理按键事件(F1-F12)

更新时间:2022-11-18 10:13:08

我对此类问题的***来源是此页面:http://www.quirksmode.org/js/keys.html

The best source I have for this kind of question is this page: http://www.quirksmode.org/js/keys.html

他们说的是 Safari 上的按键代码很奇怪,其他地方都是一致的(除了 IE 上没有按键事件,但我相信 keydown 有效).

What they say is that the key codes are odd on Safari, and consistent everywhere else (except that there's no keypress event on IE, but I believe keydown works).