event.keycode值大全keycode 8 = BackSpace BackSpace
2keycode 9 = Tab Tab
3keycode 12 = Clear
4keycode 13 = Enter
5keycode 16 = Shift_L
6keycode 17 = Control_L
7keycode 18 = Alt_L
8keycode 19 = Pause
9keycode 20 = Caps_Lock
10keycode 27 = Escape Escape
11keycode 32 = space space
12keycode 33 = Prior
13keycode 34 = Next
14keycode 35 = End
15keycode 36 = Home
16keycode 37 = Left
17keycode 38 = Up
18keycode 39 = Right
19keycode 40 = Down
20keycode 41 = Select
21keycode 42 = Print
22keycode 43 = Execute
23keycode 45 = Insert
24keycode 46 = Delete
25keycode 47 = Help
26keycode 48 = 0 equal braceright
27keycode 49 = 1 exclam onesuperior
28keycode 50 = 2 quotedbl twosuperior
29keycode 51 = 3 section threesuperior
30keycode 52 = 4 dollar
31keycode 53 = 5 percent
32keycode 54 = 6 ampersand
33keycode 55 = 7 slash braceleft
34keycode 56 = 8 parenleft bracketleft
35keycode 57 = 9 parenright bracketright
36keycode 65 = a A
37keycode 66 = b B
38keycode 67 = c C
39keycode 68 = d D
40keycode 69 = e E EuroSign
41keycode 70 = f F
42
43keycode 71 = g G
44keycode 72 = h H
45keycode 73 = i I
46keycode 74 = j J
47keycode 75 = k K
48keycode 76 = l L
49keycode 77 = m M mu
50keycode 78 = n N
51keycode 79 = o O
52keycode 80 = p P
53keycode 81 = q Q at
54keycode 82 = r R
55keycode 83 = s S
56keycode 84 = t T
57keycode 85 = u U
58keycode 86 = v V
59keycode 87 = w W
60keycode 88 = x X
61keycode 89 = y Y
62keycode 90 = z Z
63keycode 96 = KP_0 KP_0
64keycode 97 = KP_1 KP_1
65keycode 98 = KP_2 KP_2
66keycode 99 = KP_3 KP_3
67keycode 100 = KP_4 KP_4
68keycode 101 = KP_5 KP_5
69keycode 102 = KP_6 KP_6
70keycode 103 = KP_7 KP_7
71keycode 104 = KP_8 KP_8
72keycode 105 = KP_9 KP_9
73keycode 106 = KP_Multiply KP_Multiply
74keycode 107 = KP_Add KP_Add
75
76keycode 108 = KP_Separator KP_Separator
77keycode 109 = KP_Subtract KP_Subtract
78keycode 110 = KP_Decimal KP_Decimal
79keycode 111 = KP_Divide KP_Divide
80keycode 112 = F1
81keycode 113 = F2
82keycode 114 = F3
83keycode 115 = F4
84keycod
85
86e 116 = F5
87keycode 117 = F6
88keycode 118 = F7
89keycode 119 = F8
90keycode 120 = F9
91keycode 121 = F10
92keycode 122 = F11
93keycode 123 = F12
94keycode 124 = F13
95keycode 125 = F14
96keycode 126 = F15
97keycode 127 = F16
98keycode 128 = F17
99keycode 129 = F18
100keycode 130 = F19
101keycode 131 = F20
102keycode 132 = F21
103keycode 133 = F22
104keycode 134 = F23
105keycode 135 = F24
106keycode 136 = Num_Lock
107keycode 137 = Scroll_Lock
108keycode 187 = acute grave
109keycode 188 = comma semicolon
110keycode 189 = minus underscore
111keycode 190 = period colon
112keycode 192 = numbersign apostrophe
113keycode 210 = plusminus hyphen macron
114keycode 211 =
115keycode 212 = copyright registered
116keycode 213 = guillemotleft guillemotright
117keycode 214 = masculine ordfeminine
118keycode 215 = ae AE
119keycode 216 = cent yen
120keycode 217 = questiondown exclamdown
121keycode 218 = onequarter onehalf threequarters
122keycode 220 = less greater bar
123keycode 221 = plus asterisk asciitilde
124keycode 227 = multiply division
125
126keycode 228 = acircumflex Acircumflex
127keycode 229 = ecircumflex Ecircumflex
128keycode 230 = icircumflex Icircumflex
129keycode 231 = ocircumflex Ocircumflex
130keycode 232 = ucircumflex Ucircumflex
131keycode 233 = ntilde Ntilde
132keycode 234 = yacute Yacute
133keycode 235 = oslash Ooblique
134keycode 236 = aring Aring
135keycode 237 = ccedilla Ccedilla
136keycode 238 = thorn THORN
137keycode 239 = eth ETH
138keycode 240 = diaeresis cedilla currency
139keycode 241 = agrave Agrave atilde Atilde
140keycode 242 = egrave Egrave
141keycode 243 = igrave Igrave
142keycode 244 = ograve Ograve otilde Otilde
143keycode 245 = ugrave Ugrave
144keycode 246 = adiaeresis Adiaeresis
145keycode 247 = ediaeresis Ediaeresis
146keycode 248 = idiaeresis Idiaeresis
147keycode 249 = odiaeresis Odiaeresis
148keycode 250 = udiaeresis Udiaeresis
149keycode 251 = ssharp question backslash
150keycode 252 = asciicircum degree
151keycode 253 = 3 sterling
152keycode 254 = Mode_switch
153
154使用event对象的keyCode属性判断输入的键值
155eg:if(event.keyCode==13)alert(“enter!”);
156键值对应表
157A 0X65 U 0X85
158B 0X66 V 0X86
159C 0X67 W 0X87
160D 0X68 X 0X88
161E 0X69 Y 0X89
162F 0X70 Z 0X90
163G 0X71 0 0X48
164H 0X72 1 0X49
165I 0X73 2 0X50
166J 0X74 3 0X51
167K 0X75 4 0X52
168L 0X76 5 0X53
169M 0X77 6 0X54
170N 0X78 7 0X55
171O 0X79 8 0X56
172P 0X80 9 0X57
173Q 0X81 ESC 0X1B
174R 0X82 CTRL 0X11
175S 0X83 SHIFT 0X10
176T 0X84 ENTER 0XD
177
178
2keycode 9 = Tab Tab
3keycode 12 = Clear
4keycode 13 = Enter
5keycode 16 = Shift_L
6keycode 17 = Control_L
7keycode 18 = Alt_L
8keycode 19 = Pause
9keycode 20 = Caps_Lock
10keycode 27 = Escape Escape
11keycode 32 = space space
12keycode 33 = Prior
13keycode 34 = Next
14keycode 35 = End
15keycode 36 = Home
16keycode 37 = Left
17keycode 38 = Up
18keycode 39 = Right
19keycode 40 = Down
20keycode 41 = Select
21keycode 42 = Print
22keycode 43 = Execute
23keycode 45 = Insert
24keycode 46 = Delete
25keycode 47 = Help
26keycode 48 = 0 equal braceright
27keycode 49 = 1 exclam onesuperior
28keycode 50 = 2 quotedbl twosuperior
29keycode 51 = 3 section threesuperior
30keycode 52 = 4 dollar
31keycode 53 = 5 percent
32keycode 54 = 6 ampersand
33keycode 55 = 7 slash braceleft
34keycode 56 = 8 parenleft bracketleft
35keycode 57 = 9 parenright bracketright
36keycode 65 = a A
37keycode 66 = b B
38keycode 67 = c C
39keycode 68 = d D
40keycode 69 = e E EuroSign
41keycode 70 = f F
42
43keycode 71 = g G
44keycode 72 = h H
45keycode 73 = i I
46keycode 74 = j J
47keycode 75 = k K
48keycode 76 = l L
49keycode 77 = m M mu
50keycode 78 = n N
51keycode 79 = o O
52keycode 80 = p P
53keycode 81 = q Q at
54keycode 82 = r R
55keycode 83 = s S
56keycode 84 = t T
57keycode 85 = u U
58keycode 86 = v V
59keycode 87 = w W
60keycode 88 = x X
61keycode 89 = y Y
62keycode 90 = z Z
63keycode 96 = KP_0 KP_0
64keycode 97 = KP_1 KP_1
65keycode 98 = KP_2 KP_2
66keycode 99 = KP_3 KP_3
67keycode 100 = KP_4 KP_4
68keycode 101 = KP_5 KP_5
69keycode 102 = KP_6 KP_6
70keycode 103 = KP_7 KP_7
71keycode 104 = KP_8 KP_8
72keycode 105 = KP_9 KP_9
73keycode 106 = KP_Multiply KP_Multiply
74keycode 107 = KP_Add KP_Add
75
76keycode 108 = KP_Separator KP_Separator
77keycode 109 = KP_Subtract KP_Subtract
78keycode 110 = KP_Decimal KP_Decimal
79keycode 111 = KP_Divide KP_Divide
80keycode 112 = F1
81keycode 113 = F2
82keycode 114 = F3
83keycode 115 = F4
84keycod
85
86e 116 = F5
87keycode 117 = F6
88keycode 118 = F7
89keycode 119 = F8
90keycode 120 = F9
91keycode 121 = F10
92keycode 122 = F11
93keycode 123 = F12
94keycode 124 = F13
95keycode 125 = F14
96keycode 126 = F15
97keycode 127 = F16
98keycode 128 = F17
99keycode 129 = F18
100keycode 130 = F19
101keycode 131 = F20
102keycode 132 = F21
103keycode 133 = F22
104keycode 134 = F23
105keycode 135 = F24
106keycode 136 = Num_Lock
107keycode 137 = Scroll_Lock
108keycode 187 = acute grave
109keycode 188 = comma semicolon
110keycode 189 = minus underscore
111keycode 190 = period colon
112keycode 192 = numbersign apostrophe
113keycode 210 = plusminus hyphen macron
114keycode 211 =
115keycode 212 = copyright registered
116keycode 213 = guillemotleft guillemotright
117keycode 214 = masculine ordfeminine
118keycode 215 = ae AE
119keycode 216 = cent yen
120keycode 217 = questiondown exclamdown
121keycode 218 = onequarter onehalf threequarters
122keycode 220 = less greater bar
123keycode 221 = plus asterisk asciitilde
124keycode 227 = multiply division
125
126keycode 228 = acircumflex Acircumflex
127keycode 229 = ecircumflex Ecircumflex
128keycode 230 = icircumflex Icircumflex
129keycode 231 = ocircumflex Ocircumflex
130keycode 232 = ucircumflex Ucircumflex
131keycode 233 = ntilde Ntilde
132keycode 234 = yacute Yacute
133keycode 235 = oslash Ooblique
134keycode 236 = aring Aring
135keycode 237 = ccedilla Ccedilla
136keycode 238 = thorn THORN
137keycode 239 = eth ETH
138keycode 240 = diaeresis cedilla currency
139keycode 241 = agrave Agrave atilde Atilde
140keycode 242 = egrave Egrave
141keycode 243 = igrave Igrave
142keycode 244 = ograve Ograve otilde Otilde
143keycode 245 = ugrave Ugrave
144keycode 246 = adiaeresis Adiaeresis
145keycode 247 = ediaeresis Ediaeresis
146keycode 248 = idiaeresis Idiaeresis
147keycode 249 = odiaeresis Odiaeresis
148keycode 250 = udiaeresis Udiaeresis
149keycode 251 = ssharp question backslash
150keycode 252 = asciicircum degree
151keycode 253 = 3 sterling
152keycode 254 = Mode_switch
153
154使用event对象的keyCode属性判断输入的键值
155eg:if(event.keyCode==13)alert(“enter!”);
156键值对应表
157A 0X65 U 0X85
158B 0X66 V 0X86
159C 0X67 W 0X87
160D 0X68 X 0X88
161E 0X69 Y 0X89
162F 0X70 Z 0X90
163G 0X71 0 0X48
164H 0X72 1 0X49
165I 0X73 2 0X50
166J 0X74 3 0X51
167K 0X75 4 0X52
168L 0X76 5 0X53
169M 0X77 6 0X54
170N 0X78 7 0X55
171O 0X79 8 0X56
172P 0X80 9 0X57
173Q 0X81 ESC 0X1B
174R 0X82 CTRL 0X11
175S 0X83 SHIFT 0X10
176T 0X84 ENTER 0XD
177
178
如果要使用组合键,则可以利用event.ctrlKey,event.shiftKey,event .altKey判断是否按下了ctrl键、shift键以及alt键
例如:用回车模拟Tab:
<input type="text" name="textfield" onkeydown="if(event.keyCode==13)event.keyCode='9'">
<input type="text" name="textfield2">