Web JS Judging keyboard departure Events

Source: Internet
Author: User

 window.document.onkeydown = Disablerefresh;function Disablerefresh (evt) {evt = (evt)? Evt:window.eventif ( Evt.keycode) {   if (Evt.keycode = =) {    //do something  }}}keycode 8 = BackSpace Backspacekeycode 9 = Tab Tabkeycode = Clearkeycode = Enterkeycode (shift_lkeycode) = Control_lkeycode = Al T_lkeycode = Pausekeycode = Caps_lockkeycode = Escape Escapekeycode = Space Spacekeycode = Priorkeycode 34 = Nextkeycode = Endkeycode = Homekeycode PNs = Leftkeycode (upkeycode) = Rightkeycode = Downkeycode = Sel Ectkeycode = Printkeycode = Executekeycode = Insertkeycode + = Deletekeycode = Helpkeycode = 0 equal brace Rightkeycode = 1 Exclam onesuperiorkeycode = 2 Quotedbl twosuperiorkeycode Wuyi = 3 section Threesuperiorkeycode 52 = 4 Dollarkeycode = 5 Percentkeycode = 6 Ampersandkeycode = 7 Slash braceleftkeycode 8 Parenleft Bracketleftke Ycode = 9 Parenright BracketriGhtkeycode = a Akeycode = b Bkeycode = c Ckeycode = d Dkeycode = e e Eurosignkeycode = f Fkeycode = g Gkeycode = h Hkeycode = i ikeycode = J Jkeycode = k Kkeycode = L Lkeycode * = m M mukeycode = n Nkeyco De + = o okeycode = p Pkeycode bayi = q Q atkeycode = R Rkeycode = s Skeycode p = t tkeycode = u ukeycode 86 = V Vkeycode = w Wkeycode = x xkeycode = y Ykeycode = z zkeycode = kp_0 kp_0keycode = kp_1 Kp_1keycode 98 = kp_2 Kp_2keycode = kp_3 Kp_3keycode = kp_4 Kp_4keycode 101 = kp_5 Kp_5keycode 102 = kp_6 Kp_6keycode 103 = KP_7 Kp_7keycode 104 = Kp_8 Kp_8keycode = kp_9 Kp_9keycode 106 = kp_multiply Kp_multiplykeycode 107 = KP_Add KP_Addkeycode 108 = kp_separator Kp_separatorkeycode 109 = kp_subtract Kp_subtractkeycode = kp_decimal KP_Decimalkeycode 111 = KP_Di Vide Kp_dividekeycode F2keycode = F1keycode 113 = F3keycode (F4keycode) = F5keycode (= 117) = 118 = F7keycode 119 = F8KEYCOde = F9keycode 121 = F10keycode 122 = F11keycode 123 = F12keycode 124 = F13keycode = F14keycode 126 = F15keycode 127 = F16keycode = F17keycode 129 = F18keycode = F19keycode 131 = F20keycode = F21keycode 133 = F22keycode 134 = F23keycode 135 = F24keycode 136 = Num_lockkeycode 137 = Scroll_lockkeycode 187 = Acute Gravekeycode 188 = comma Semicol Onkeycode 189 = minus Underscorekeycode = period Colonkeycode 192 = numbersign Apostrophekeycode = Plusminus Hyphe N Macronkeycode 211 =keycode 212 = Copyright Registeredkeycode 213 = guillemotleft Guillemotrightkeycode 214 = masculine O Rdfemininekeycode 215 = ae Aekeycode 216 = cent Yenkeycode 217 = questiondown Exclamdownkeycode 218 = onequarter Onehalf t Hreequarterskeycode = Less greater barkeycode 221 = plus asterisk asciitildekeycode 227 = multiply Divisionkeycode 228 = Acircumflex Acircumflexkeycode 229 = Ecircumflex Ecircumflexkeycode = Icircumflex Icircumflexkeycode 231 = ocircumf Lex Ocircumflexkeycode 2Ucircumflex Ucircumflexkeycode 233 = Ntilde Ntildekeycode 234 = yacute Yacutekeycode 235 = Oslash Oobliquekeycode 236 = aring Aringkeycode 237 = Ccedilla Ccedillakeycode 238 = Thorn Thornkeycode 239 = eth Ethkeycode = diaeresis cedilla currencykeycode 241 = agrave Agrave atilde Atildekeycode 242 = egrave Egravekeycode 243 = igrave Igravekeycode 244 = ogra ve ograve otilde otildekeycode 245 = ugrave Ugravekeycode 246 = adiaeresis Adiaeresiskeycode 247 = ediaeresis Ediaeresiske Ycode 248 = idiaeresis Idiaeresiskeycode 249 = odiaeresis Odiaeresiskeycode = udiaeresis Udiaeresiskeycode 251 = Sshar P question Backslashkeycode 252 = asciicircum Degreekeycode 253 = 3 Sterlingkeycode 254 = Mode_switch Use the KeyCode property of the event object to determine The input key value Eg:if (event.keycode==13) {var iekey=event.keycode;//gets the key value, the numeric form of the
var realkey=string.fromcharcode (Iekey)//Converts the key value in digital form to the real key alert (Realkey);} Key value corresponds to table a 0X65 U 0x85b 0X66 V 0x86c 0X67 W 0x87d 0X68 X 0x88e 0X69 Y 0x89f 0X70 Z 0x90g 0X71 0 0X   48H 0X72 1 0x49i 0x73 2 0x50j 0X74 3 0x51k 0x75 4 0x52l 0X76 5 0x53m 0X77 6 0x54n 0X78 7 0x55o 0X79 8 0x56p 0X80 9 0x57q 0X81 ESC 0x1br 0X82 CTRL 0x11s 0X83 SHIFT 0x10t 0X84 ENTER 0XD If you want to use a composite key, you can take advantage of the event . ctrlkey,event.shiftkey,event. Altkey to determine if the CTRL, SHIFT, and ALT keys are pressed

Web JS Judging keyboard departure Events

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.