js中会用到的键盘码
来源:互联网 发布:淘宝情趣直通车 编辑:程序博客网 时间:2024/05/07 10:58
Question: Are the keyCode
values of keydown/keyup
events standardized across browsers?
Answer: No, unfortunately, not all key codes are standardized. For example, the minus key has different key codes in different browsers. The table below shows the event.keyCode
values for keydown
and keyup
events in Opera 25, Internet Exlorer 11, Firefox 32, Safari 5.1, and Google Chrome 38. If you are interested in key codes for older browsers (ca.2011), please refer towww.javascripter.net/faq/keycodes2011.htm or, for even older bowsers, see the W3C Working Group Note Legacy Keyboard Event Properties. Common key codes that are relatively safe to use across browsers are shown in black. Key codes that differ across browsers are shown in red. Do not use this table forcharacter codes keypress
keypress
character codes are not key-specific and may be enirely different from keydown/keyup
key codes.
keydown/keyup event.keyCode Opera MSIE Firefox Safari Chrome Key pressed_________________________________________________________ 8 8 8 8 8 Backspace 9 9 9 9 9 Tab 13 13 13 13 13 Enter 16 16 16 16 16 Shift 17 17 17 17 17 Ctrl 18 18 18 18 18 Alt 19 19 19 19 19 Pause, Break 20 20 20 20 20 CapsLock 27 27 27 27 27 Esc 32 32 32 32 32 Space 33 33 33 33 33 Page Up 34 34 34 34 34 Page Down 35 35 35 35 35 End 36 36 36 36 36 Home 37 37 37 37 37 Left arrow 38 38 38 38 38 Up arrow 39 39 39 39 39 Right arrow 40 40 40 40 40 Down arrow 44 44 44 44 PrntScrn (see below†) 45 45 45 45 45 Insert 46 46 46 46 46 Delete 48-57 48-57 48-57 48-57 48-57 0 to 9 65-90 65-90 65-90 65-90 65-90 A to Z 91 91 91 91 91 WIN Key (Start) 93 93 93 93 93 WIN Menu112-123 112-123 112-123 112-123 112-123 F1 to F12 144 144 144 144 144 NumLock145 145 145 145 145 ScrollLock188 188 188 188 188 , <190 190 190 190 190 . >191 191 191 191 191 / ?192 192 192 192 192 ` ~219 219 219 219 219 [ { (see below‡)220 220 220 220 220 \ |221 221 221 221 221 ] }222 222 222 222 222 ' "†
keyup
events only.‡
The following key codes differ across browsers:
keydown/keyup event.keyCode Opera MSIE Firefox Safari Chrome Key pressed_________________________________________________________ 173 173 181 173 173 Mute On|Off 174 174 182 174 174 Volume Down 175 175 183 175 175 Volume Up 186 186 59 186 186 ; : 187 187 61 187 187 = + 189 189 173 189 189 - _
The numeric keypad may produce different keycodes depending on the NumLock state:All of the above browsers (NumLock On/Off) Key pressed__________________________________________________________ 96/45 Numpad 0 Ins 97/35 Numpad 1 End 98/40 Numpad 2 Down 99/34 Numpad 3 Pg Down 100/37 Numpad 4 Left 101/12 Numpad 5 102/39 Numpad 6 Right 103/36 Numpad 7 Home 104/38 Numpad 8 Up 105/33 Numpad 9 Pg Up 106/106 Numpad * 107/107 Numpad + 109/109 Numpad - 110/46 Numpad . Del 111/111 Numpad /
See also:
- js中会用到的键盘码
- ios开发中会用到的工具
- 编程中会用到的东西
- dts中会用到的MODULE_DEVICE_TABLE
- JavaScript实战中会用到的算法
- 软件开发中会用到的图
- 前端后端会用到的最齐全js类库
- 一些经常会用到的原生JS方法
- 做网站经常会用到的一些js效果
- 做网站经常会用到的一些js效果
- 会用到的
- 网页中经常用到的JS脚本
- SQLserver中会用到的命令(随时补充)
- 数据中经常会用到的日期转换
- iOS开发中会经常用到文件上传下载的功能
- iOS 项目中经常会用到的宏定义
- Makefile 中经常会用到一些内置的标准变量
- php.ini中经常会用到的一些配置
- 制作jar文件
- Linux下 文件夹 压缩 解压缩 打包
- 预定义宏
- 易經大意原稿(頁單位) 451-480
- android关于GPS hal层的分析
- js中会用到的键盘码
- netif_receive_skb 函数注解
- 通过configure文件学习shell
- JAVA制作jar包
- sgu149: Computer Network
- Apache Rewrite url重定向功能的简单配置
- SQL调用WebService接口
- 【技术收藏】特别好的网盘资料
- Android数据的四种存储方式