JS capture keyboard events and keys Key values method _javascript tips

Source: Internet
Author: User

The

looks like this:

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">  

JS Keyboard key value

KeyCode 8 = BackSpace BackSpace keycode 9 = tab Tab keycode = Clear KeyCode = Enter KeyCode = shift_l k Eycode = control_l KeyCode = alt_l KeyCode = Pause keycode = Caps_lock keycode (km) = Escape Escape ke Ycode = Space Spaces keycode = Prior keycode (Next keycode) = End keycode = Home KeyCode Panax Notoginseng = Lef T keycode = up keycode/Right keycode = down KeyCode = Select KeyCode = Print keycode = Exe Cute keycode = Insert keycode (Delete keycode) = Help keycode mb = 0 equal braceright keycode-1 ex Clam Onesuperior keycode = 2 Quotedbl twosuperior keycode Wuyi = 3 section Threesuperior keycode-4 Dollar key Code = 5 percent KeyCode = 6 ampersand keycode-7 slash Braceleft keycode = 8 Parenleft bracketleft k Eycode = 9 Parenright bracketright keycode (a) keycode (b) KeyCode (c c keycode) = d d keycod E-ke = e e eurosignYcode = f f keycode (g g keycode) = h h keycode = i i keycode, J j KeyCode a = k K keycode 7 6 = l l keycode = m mu keycode = n n keycode-p = o KeyCode (PS) keycode Bayi = q Q at keycode 82 = r R KeyCode (s keycode) = t T keycode = u u keycode = v v keycode r = w keycode) = x x k Eycode (Y-y keycode) = Z Z keycode = kp_0 kp_0 keycode, kp_1 kp_1 keycode = kp_2 kp_2 keycode 9  9 = kp_3 KeyCode = kp_4 kp_4 keycode kp_3 = kp_5 kp_5 keycode 102 = kp_6 kp_6 keycode-kp_7 kp_7  Kp_8 keycode kp_9 kp_9 keycode kp_8 = kp_multiply kp_multiply keycode = Kp_add Kp_add keycode 108 = Kp_separator Kp_separator KeyCode 109 = kp_subtract kp_subtract keycode, kp_decimal kp_decimal, keycode = KP  _divide kp_divide keycode 112 = F1 KeyCode 113 = F2 KeyCode 114 = F3 KeyCode 117 = F4 KeyCode 116 = F5 KeyCode = F6 KeyCode 118 = F7 kEycode 119 = F8 KeyCode-F9 keycode 121 = F10 KeyCode 122 = F11 KeyCode 123 = F12 KeyCode 124 = F13 KeyCode 125 
= F14 KeyCode 126 = F15 KeyCode 127 = F16 keycode 128 = F17 KeyCode 129 = F18 keycode 130 = F19 KeyCode 131 = F20 KeyCode 132 = F21 keycode the "F22" KeyCode "134" F23 the KeyCode = The 135 of the F24 = to KeyCode 136 Num_lock 
Ock KeyCode 187 = Acute grave keycode-188 = comma semicolon keycode 189 = minus underscore keycode 190 = period Colon KeyCode numbersign apostrophe keycode 210 = plusminus hyphen Macron KeyCode 211 = keycode 212 = Copyright Regist Ered keycode 213 = Guillemotleft guillemotright keycode 214 = masculine ordfeminine keycode 215 = AE AE keycode 216 = Yen KeyCode 217 = Questiondown Exclamdown keycode 218 = onequarter onehalf threequarters keycode cent = less greate R Bar KeyCode 221 = plus asterisk Asciitilde keycode MB = Multiply Division KeyCode 228 = Acircumflex Acircumflex key Code 229 = Ecircumflex Ecircumflex 
keycode 230 = icircumflex Icircumflex 
keycode 231 = ocircumflex Ocircumflex 
keycode 232 = ucircumflex Ucircu 
mflex 
keycode 233 = ntilde Ntilde 
keycode 234 = yacute Yacute 
keycode 235 = oslash Ooblique 
keycode 236 = aring Aring KeyCode 237 = Ccedilla Ccedilla keycode 238 = Thorn Thorn keycode 239 = eth eth keycode = diaeresis cedilla Cy KeyCode 241 = agrave agrave Atilde atilde keycode 242 = egrave egrave keycode 243 = igrave Igrave keycode 244 = ogr ave Ograve otilde Otilde 
keycode 245 = ugrave Ugrave 
keycode 246 = adiaeresis Adiaeresis 
keycode 247 = ediaeresis Ediae resis 
keycode 248 = idiaeresis Idiaeresis 
keycode 249 = odiaeresis Odiaeresis 
keycode 250 = udiaeresis Udiaeresis 
keyc  Ode 251 = ssharp question backslash keycode 252 = asciicircum degree keycode 253 = 3 Sterling KeyCode 254 = Mode_switch
Document.onkeydown = KeyDown;
function KeyDown () {
 var keycode = Event.keycode;
 if (keycode =) {
 alert (' Test ');
 }
}

<body onload= "JavaScript:document.getElementById (' Textfield2 '). focus ();" >

The above is small series for everyone to bring JS to catch keyboard events and key values of the method of all content, I hope that we support cloud-Habitat Community ~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.