event.keyCode의 값은 key event에 따라 그 값이 변한다.

'흔히 알고 있는 keyCode 값'은 onKeyDown 이나 onKeyUp Event 를 통해 추출할 수 있는 값들이고,
이 외에 onKeyPress 를 이용했을 경우에는 keyCode값이 달라진다.

사용예 : onKeyPress="if(event.keyCode==45) event.returnValue=false;"

key
press
key
down
key
up
Esc27(IE만)2727
F1-112-
F2-113113
F3-114114
F4-115115
F5-116116
F6-117-
F7-118118
F8-119119
F9-120120
F10-121121
F11-122122
F12-123123
key
press
key
down
key
up
0484848
1494949
2505050
3515151
4525252
5535353
6545454
7555555
8565656
9575757
key
press
key
down
key
up
~126192192
!334949
@645050
#355151
$365252
%375353
^945454
&385555
*425656
(405757
)414848
_95189189
+43187187
|124220220
`96192192
-45189189
=61187187
\92220220
{123219219
[91219219
}125221221
]93221221
:58186186
;59186186
"34222222
'39222222
<60188188
>62190190
?63191191
,44188188
.46190190
/47191191
key
press
key
down
key
up
PrintScreen--44
(IE외)
ScrollLock-145145
Pause-1919
BackSpace-88
Tab-9-
CapsLock-2020
Enter131313
Shift-1616
Left Ctrl-1717
Left
WindowMenu
-9191
Left Alt-1818
한자-25-
SpaceBar323232
한/영-229-
Right Alt-22921
Right
WindowMenu
-9292
Context Menu-9393
Right Ctrl-2525
Insert-4545
Home-3636
PageUp-3333
Delete-4646
End-3535
PageDown-3434
NumLock-144144
key
press
key
down
key
up
Up(↑)-3838
Left(←)-3737
Down(↓)-4040
Right(→)-3939
NumPadkey
press
key
down
key
up
/47111111
*42106106
-45109109
755103103
856104104
957105105
+43107107
452100100
553101101
654102102
1499797
2509898
3519999
0489696
.46110110
Enter131313
Home-3636
Up(↑)-3838
PageUp-3333
Left(←)-3737
Clear-1212
Right(→)-3939
End-3535
Down(↓)-4040
PageDown-3434
Insert-4545
Delete-4646
key
press
key
down
key
up
a976565
A656565
b986666
B666666
c996767
C676767
d1006868
D686868
e1016969
E696969
f1027070
F707070
g1037171
G717171
h1047272
H727272
i1057373
I737373
j1067474
J747474
k1077575
K757575
l1087676
L767676
m1097777
M777777
n1107878
N787878
o1117979
O797979
p1128080
P808080
q1138181
Q818181
r1148282
R828282
s1158383
S838383
t1168484
T848484
u1178585
U858585
v1188686
V868686
w1198787
W878787
x1208888
X888888
y1218989
Y898989
z1229090
Z909090


반응형

+ Recent posts