Smart Tools
Blog博客
Theme
Cerca
Keycode values for alphanumeric and numeric keys
keystrokes keycode keystrokes keycode
A 65 S 83
B 66 T 84
C 67 U 85
D 68 V 86
E 69 W 87
F 70 X 88
G 71 Y 89
H 72 Z 90
I 73 0 48
J 74 1 49
K 75 2 50
L 76 3 51
M 77 4 52
N 78 5 53
O 79 6 54
P 80 7 55
Q 81 8 56
R 82 9 57
Keycode values for numeric keypad keys
keystrokes keycode keystrokes keycode
0 96 8 104
1 97 9 105
2 98 * 106
3 99 + 107
4 100 Enter 108
5 101 - 109
6 102 . 110
7 103 / 111
Function key code value
keystrokes keycode keystrokes keycode
F1 112 F7 118
F2 113 F8 119
F3 114 F9 120
F4 115 F10 121
F5 116 F11 122
F6 117 F12 123
Control key code values
keystrokes keycode keystrokes keycode
BackSpace 8 Esc 27
Tab 9 Spacebar 32
Clear 12 Page Up 33
Enter 13 Page Down 34
Shift 16 End 35
Control 17 Home 36
Alt 18 Left Arrow 37
Cape Lock 20 Up Arrow 38
Right Arrow 39 -_ 189
Dw Arrow 40 .> 190
Insert 45 /? 191
Delete 46 `~ 192
Num Lock 144 [{ 219
;: 186 /| 220
=+ 187 ]} 221
,< 188 '" 222
Multimedia keycode values
keystrokes keycode keystrokes keycode
volume plus 175 volume reduction 174
cessation 179 unmute 173
browser (software) 172 mails 180
look for sth. 170 favorite 171
Introduzione al codice tasto:

1. Il codice chiave (keyCode) è un valore associato a un determinato tasto della tastiera, fornito dal browser quando si verifica un evento della tastiera.

2. Quando l'utente preme un tasto sulla tastiera, JavaScript può accedere a questo codice tramite l'oggetto evento, determinando così quale tasto è stato premuto.

3. Il codice chiave viene solitamente utilizzato nei seguenti eventi JavaScript:

(1) Evento keydown: viene attivato quando l'utente preme un tasto qualsiasi sulla tastiera.

(2) Evento keyup: si attiva quando l'utente rilascia un tasto della tastiera.

4. Limitazioni del codice tasto: non distingue tra maiuscole e minuscole, non ha restrizioni relative alla disposizione della tastiera e i tasti funzione non generano un codice tasto.

5. I codici chiave potrebbero essere deprecati in futuro; quando si utilizzano i codici chiave, è possibile ricorrere ad alternative.

Recommended Tools
Home Cerca Preferiti Lingua