键盘code表,供自己查询,免去console.log出code,然后再写的麻烦。
KeyCode Table
数字键 | KeyCode | F1-F12 | KeyCode | 小键盘 | KeyCode |
1 | 49 | F1 | 112 | Numbpad 0 | 96 |
2 | 50 | F2 | 113 | Numbpad1 | 97 |
3 | 51 | F3 | 114 | Numbpad2 | 98 |
4 | 52 | F4 | 115 | Numbpad3 | 99 |
5 | 53 | F5 | 116 | Numbpad4 | 100 |
6 | 54 | F6 | 117 | Numbpad5 | 101 |
7 | 55 | F7 | 118 | Numbpad6 | 102 |
8 | 56 | F8 | 119 | Numbpad7 | 103 |
9 | 57 | F9 | 120 | Numbpad8 | 104 |
| | F10 | 121 | Numbpad9 | 105 |
| | F11 | 122 | Multiply(*) | 106 |
| | F12 | 123 | Add(+) | 107 |
| | | | Enter | 108 |
| | | | Subtract(-) | 109 |
| | | | Decimal(.) | 110 |
| | | | Divide(/) | 111 |
字母 | KeyCode | 字母 | KeyCode | 其他键 | KeyCode | 其他键 | KeyCode |
A | 65 | N | 78 | Backspace | 8 | Left Arrow | 37 |
B | 66 | O | 79 | Tab | 9 | Up Arrow | 38 |
C | 67 | P | 80 | Clear | 12 | Right Arrow | 39 |
D | 68 | Q | 81 | Enter | 13 | Down Arrow | 40 |
E | 69 | R | 82 | Shift | 16 | Insert | 45 |
F | 70 | S | 83 | Control | 17 | Delete | 46 |
G | 71 | T | 84 | Alt | 18 | Help | 47 |
H | 72 | U | 85 | Caps Lock | 20 | Num Lock | 144 |
I | 73 | V | 86 | Esc | 27 | ;: | 186 |
J | 74 | W | 87 | Spacebar | 32 | =+ | 187 |
K | 75 | X | 88 | Page Up | 33 | -_ | 189 |
L | 76 | Y | 89 | Page Down | 34 | /? | 191 |
M | 77 | Z | 90 | End | 35 | ~` | 192 |
| | | | Home | 36 | [{ | 219 |
| | | | | | \| | 220 |
| | | | | | ]} | 221 |
| | | | | | ''' | 222 |