event.which:window.event.keyCode; //event.keyCode按的建的代码,13表示回车 if ( lKeyCode == 13 ){ NextElement.focus...false; } irfirefox2.0中不支持 window.event.keyCode, 但是我们可以用event.which代替。...但是为了使其能更具有普遍的兼容性,最好用event.keyCode|| event.which....Keycode对照表 字母和数字键的键码值(keyCode)按键键码按键键码按键键码按键键码A65J74S83149B66K75T84250C67L76U85351D68M77V86452E69N78W87553F70O79X88654G71P80Y89755H72Q81Z90856I73R82048957...数字键盘上的键的键码值(keyCode)功能键键码值(keyCode)按键键码按键键码按键键码按键键码0968104F1112F71181979105F2113F8119298*106F3114F9120399
Enter keyCode 16 = Shift_L keyCode 17 = Control_L keyCode 18 = Alt_L keyCode 19 = Pause keyCode 20 =...35 = End keyCode 36 = Home keyCode 37 = Left keyCode 38 = Up keyCode 39 = Right keyCode 40 = Down keyCode...keyCode 65 = a A keyCode 66 = b B keyCode 67 = c C keyCode 68 = d D keyCode 69 = e E EuroSign keyCode...70 = f F keyCode 71 = g G keyCode 72 = h H keyCode 73 = i I keyCode 74 = j J keyCode 75 = k K keyCode...keyCode 82 = r R keyCode 83 = s S keyCode 84 = t T keyCode 85 = u U keyCode 86 = v V keyCode 87 = w W
https://segmentfault.com/a/1190000005828048 字母和数字键的键码值(keyCode) 按键 键码 按键 键码 按键 键码 按键 键码 A 65 J 74 S 83...87 5 53 F 70 O 79 X 88 6 54 G 71 P 80 Y 89 7 55 H 72 Q 81 Z 90 8 56 I 73 R 82 0 48 9 57 数字键盘上的键的键码值(keyCode...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 功能键键码值(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 控制键键码值(keyCode...36 ;: 186 \| 220 Alt 18 Left Arrow 37 =+ 187 ]} 221 Cape Lock 20 Up Arrow 38 ,< 188 ‘” 222 多媒体键码值(keyCode
QQ拼音截图20200518133229.png 字母和数字键的键码值(keyCode) 按键键码按键键码按键键码按键键码A65J74S83149B66K75T84250C67L76U85351D68M77V86452E69N78W87553F70O79X88654G71P80Y89755H72Q81Z90856I73R82048957...数字键盘上的键的键码值(keyCode) 按键键码按键键码09681041979105298*106399+1074100Enter1085101-1096102.1107103/111 功能键键码值...(keyCode) 按键键码按键键码按键键码按键键码BackSpace8Esc27Right Arrow39-_189Tab9Spacebar32Dw Arrow40.>190Clear12Page Up33Insert45...Lock144[{219Control17Home36;:186\|220Alt18Left Arrow37=+187}]221Cape Lock20Up Arrow38,<188'"222 多媒体键码值(keyCode
字母和数字键的键码值(keyCode) 按键 键码 按键 键码 按键 键码 按键 键码 A 65 J 74 S 83 1 49 B 66 K 75 T 84 2 50 C 67 L 76 U 85 3...87 5 53 F 70 O 79 X 88 6 54 G 71 P 80 Y 89 7 55 H 72 Q 81 Z 90 8 56 I 73 R 82 0 48 9 57 数字键盘上的键的键码值(keyCode...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 功能键键码值(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 控制键键码值(keyCode...36 ;: 186 \| 220 Alt 18 Left Arrow 37 =+ 187 ]} 221 Cape Lock 20 Up Arrow 38 ,< 188 '" 222 多媒体键码值(keyCode
这样,我先把写的获取键盘keyCode的方法附上: html语言 <div style="width: 500px;height: 200px;background-color: cyan;" id="...function(event){ var event=event||window.event; document.getElementById("showZone").innerHTML=event.keyCode
实际应用中,也可以判断左右箭头实现文章上下篇的切换等实用功能 字母和数字键的键码值(keyCode) 按键 键码 按键 键码 按键 键码 按键 键码 A 65 J 74 S 83 1 49 B 66...87 5 53 F 70 O 79 X 88 6 54 G 71 P 80 Y 89 7 55 H 72 Q 81 Z 90 8 56 I 73 R 82 0 48 9 57 数字键盘上的键的键码值(keyCode...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 功能键键码值(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 控制键键码值(keyCode...Home 36 ;: 186 | 220 Alt 18 Left Arrow 37 =+ 187 } 221 Cape Lock 20 Up Arrow 38 ,< 188 '" 222 多媒体键码值(keyCode
” 6 –> “KEYCODE_ENDCALL” 7 –> “KEYCODE_0” 8 –> “KEYCODE_1” 9 –> “KEYCODE_2” 10 –> “KEYCODE_3” 11...–> “KEYCODE_4” 12 –> “KEYCODE_5” 13 –> “KEYCODE_6” 14 –> “KEYCODE_7” 15 –> “KEYCODE_8” 16 –> “KEYCODE...“KEYCODE_F” 35 –> “KEYCODE_G” 36 –> “KEYCODE_H” 37 –> “KEYCODE_I” 38 –> “KEYCODE_J” 39 –> “KEYCODE_K...–> “KEYCODE_Q” 46 –> “KEYCODE_R” 47 –> “KEYCODE_S” 48 –> “KEYCODE_T” 49 –> “KEYCODE_U” 50 –> “KEYCODE_V...功能键 KEYCODE_F1 按键F1 KEYCODE_F2 按键F2 KEYCODE_F3 按键F3 KEYCODE_F4 按键F4 KEYCODE_F5 按键F5 KEYCODE_F6
keyCode 12 = Clear 5 keyCode 13 = Enter 6 keyCode 16 = Shift_L 7 keyCode 17 = Control_L 8 keyCode...17 keyCode 37 = Left 18 keyCode 38 = Up 19 keyCode 39 = Right 20 keyCode 40 = Down 21 keyCode 41...F 43 keyCode 71 = g G 44 keyCode 72 = h H 45 keyCode 73 = i I 46 keyCode 74 = j J 47 keyCode 75...= k K 48 keyCode 76 = l L 49 keyCode 77 = m M mu 50 keyCode 78 = n N 51 keyCode 79 = o O 52 keyCode...keyCode 85 = u U 58 keyCode 86 = v V 59 keyCode 87 = w W 60 keyCode 88 = x X 61 keyCode 89 = y Y
” 7 –> “KEYCODE_0” 8 –> “KEYCODE_1” 9 –> “KEYCODE_2” 10 –> “KEYCODE_3” 11 –> “KEYCODE_4” 12 –> “KEYCODE...” 31 –> “KEYCODE_C” 32 –> “KEYCODE_D” 33 –> “KEYCODE_E” 34 –> “KEYCODE_F” 35 –> “KEYCODE_G” 36 –> “KEYCODE_H...” 37 –> “KEYCODE_I” 38 –> “KEYCODE_J” 39 –> “KEYCODE_K” 40 –> “KEYCODE_L” 41 –> “KEYCODE_M” 42 –> “KEYCODE_N...” 43 –> “KEYCODE_O” 44 –> “KEYCODE_P” 45 –> “KEYCODE_Q” 46 –> “KEYCODE_R” 47 –> “KEYCODE_S” 48 –> “KEYCODE_T...” 49 –> “KEYCODE_U” 50 –> “KEYCODE_V” 51 –> “KEYCODE_W” 52 –> “KEYCODE_X” 53 –> “KEYCODE_Y” 54 –> “KEYCODE_Z
" 5 --> "KEYCODE_CALL" 6 --> "KEYCODE_ENDCALL" 7 --> "KEYCODE_0" 8 --> "KEYCODE_1" 9 --> "KEYCODE..._2" 10 --> "KEYCODE_3" 11 --> "KEYCODE_4" 12 --> "KEYCODE_5" 13 --> "KEYCODE_6" 14 --> "KEYCODE..." 31 --> "KEYCODE_C" 32 --> "KEYCODE_D" 33 --> "KEYCODE_E" 34 --> "KEYCODE_F" 35 --> "KEYCODE_G..." 36 --> "KEYCODE_H" 37 --> "KEYCODE_I" 38 --> "KEYCODE_J" 39 --> "KEYCODE_K" 40 --> "KEYCODE_L..." 41 --> "KEYCODE_M" 42 --> "KEYCODE_N" 43 --> "KEYCODE_O" 44 --> "KEYCODE_P" 45 --> "KEYCODE_Q
KEYCODE_0” 8 — “KEYCODE_1” 9 — “KEYCODE_2” 10 — “KEYCODE_3” 11 — “KEYCODE_4” 12 — “KEYCODE..._5” 13 — “KEYCODE_6” 14 — “KEYCODE_7” 15 — “KEYCODE_8” 16 — “KEYCODE_9” 17 — “KEYCODE_STAR...“KEYCODE_B” 31 — “KEYCODE_C” 32 — “KEYCODE_D” 33 — “KEYCODE_E” 34 — “KEYCODE_F” 35 —...“KEYCODE_G” 36 — “KEYCODE_H” 37 — “KEYCODE_I” 38 — “KEYCODE_J” 39 — “KEYCODE_K” 40 — “...KEYCODE_L” 41 — “KEYCODE_M” 42 — “KEYCODE_N” 43 — “KEYCODE_O” 44 — “KEYCODE_P” 45 — “KEYCODE_Q
-> "KEYCODE_0" 8 --> "KEYCODE_1" 9 --> "KEYCODE_2" 10 --> "KEYCODE_3" 11 --> "KEYCODE_4" 12...--> "KEYCODE_5" 13 --> "KEYCODE_6" 14 --> "KEYCODE_7" 15 --> "KEYCODE_8" 16 --> "KEYCODE_9"..." 33 --> "KEYCODE_E" 34 --> "KEYCODE_F" 35 --> "KEYCODE_G" 36 --> "KEYCODE_H" 37 --> "KEYCODE_I..." 38 --> "KEYCODE_J" 39 --> "KEYCODE_K" 40 --> "KEYCODE_L" 41 --> "KEYCODE_M" 42 --> "KEYCODE_N..." 43 --> "KEYCODE_O" 44 --> "KEYCODE_P" 45 --> "KEYCODE_Q" 46 --> "KEYCODE_R" 47 --> "KEYCODE_S
keyCode 35 = End keyCode 36 = Home keyCode 37 = Left keyCode 38 = Up keyCode 39 = Right keyCode...keyCode 79 = o O keyCode 80 = p P keyCode 81 = q Q at keyCode 82 = r R keyCode 83 = s S keyCode...84 = t T keyCode 85 = u U keyCode 86 = v V keyCode 87 = w W keyCode 88 = x X keyCode 89 = y Y keyCode...= F2 keyCode 114 = F3 keyCode 115 = F4 keyCode 116 = F5 keyCode 117 = F6 keyCode 118 = F7 keyCode...keyCode 125 = F14 keyCode 126 = F15 keyCode 127 = F16 keyCode 128 = F17 keyCode 129 = F18 keyCode
keycode 9 = Tab Tab keycode 12 = Clear keycode 13 = Enter keycode 16 = Shift_L keycode 17...Escape keycode 32 = space space keycode 33 = Prior keycode 34 = Next keycode 35 = End keycode...113 = F2 keycode 114 = F3 keycode 115 = F4 keycode 116 = F5 keycode 117 = F6 keycode 118 = F7 keycode...119 = F8 keycode 120 = F9 keycode 121 = F10 keycode 122 = F11 keycode 123 = F12 keycode 124 = F13 keycode...keycode 131 = F20 keycode 132 = F21 keycode 133 = F22 keycode 134 = F23 keycode 135 = F24 keycode 136
keyCode 42 = Print keyCode 43 = Execute keyCode 45 = Insert keyCode 46 = Delete keyCode 47 = Help keyCode...F keyCode 71 = g G keyCode 72 = h H keyCode 73 = i I keyCode 74 = j J keyCode 75 = k K keyCode 76 =...l L keyCode 77 = m M mu keyCode 78 = n N keyCode 79 = o O keyCode 80 = p P keyCode 81 = q Q at keyCode...82 = r R keyCode 83 = s S keyCode 84 = t T keyCode 85 = u U keyCode 86 = v V keyCode 87 = w W keyCode...113 = F2 keyCode 114 = F3 keyCode 115 = F4 keyCode 116 = F5 keyCode 117 = F6 keyCode 118 = F7 keyCode
keycode 35 = End keycode 36 = Home keycode 37 = Left keycode 38 = Up keycode 39 = Right keycode 40 = ...keycode 75 = k K keycode 76 = l L keycode 77 = m M mu keycode 78 = n N keycode 79 = o O keycode 80 = ...p P keycode 81 = q Q at keycode 82 = r R keycode 83 = s S keycode 84 = t T keycode 85 = u U keycode 86...keycode 112 = F1 keycode 113 = F2 keycode 114 = F3 keycode 115 = F4 keycode 116 = F5 keycode 117 = F6...keycode 118 = F7 keycode 119 = F8 keycode 120 = F9 keycode 121 = F10 keycode 122 = F11 keycode 123 =
Escape keyCode 32 = space keyCode 33 = Prior keyCode 34 = Next keyCode 35 = End keyCode 36 = Home keyCode...A keyCode 66 = b B keyCode 67 = c C keyCode 68 = d D keyCode 69 = e E EuroSign keyCode 70 = f F keyCode...71 = g G keyCode 72 = h H keyCode 73 = i I keyCode 74 = j J keyCode 75 = k K keyCode 76 = l L keyCode...keyCode 83 = s S keyCode 84 = t T keyCode 85 = u U keyCode 86 = v V keyCode 87 = w W keyCode 88 = x X...F2 keyCode 114 = F3 keyCode 115 = F4 keyCode 116 = F5 keyCode 117 = F6 keyCode 118 = F7 keyCode 119
函数原型: public boolean onKeyDown(int keyCode, KeyEvent event); 第一个参数是用户按下键时,当前所接收到的按键代号; 第二个参数是按键事件的对象。...直接在主 acivity 中重写即可,一般使用开关语句 switch 来把keyCode 和 (event.按键类型) 对比来执行对应的操作。...= 25; 68 /** Key code constant: Power key. */ 69 public static final int KEYCODE_POWER...event) { 3 3 // TODO Auto-generated method stub 4 4 5 5 if(keyCode==KeyEvent.KEYCODE_BACK...case KeyEvent.KEYCODE_CAMERA: 10 11 break; 12 case KeyEvent.KEYCODE_DPAD_CENTER
领取专属 10元无门槛券
手把手带您无忧上云