First, the key scan code, get Event.Keycode
8 退 格 9 Tab 12 keypad <5> Numlock unlocked time 13 Enter 16 Shift 17 CTRL 18 Alt 19 Pause Break 20 Capslock 27 ESC 33 PGUP 34 PGDN 35 End 36 Home 37 ← 38 ↑ 39 → 40 ↓ 45 INSERT And keyboard INS 46 delete and small keyboard Del 48 0) 49 1! 50 2 @ 51 3 # 52 4 $ 53 5% 54 6 ^ 55 7 & 56 8 * 57 9 (65 A (lowercase) 66 B 67 C 68 D 69 E 70 F 71 G 72 H 73 i 74 J 75 K 76 L 77 M 78 N 79 o 80 P 81 Q 82 R 83 S 84 T 85 u 86 V 87 W 88 x 89 Y 90 Z 91 left Window key 92 right window key 93 imitation right mouse button 96 0 (keypad) 97 1 (keypad) 98 2 (keypad) 99 3 (keypad) 100 4 (keypad) 101 5 (keypad) 102 6 Keypad) 103 7 (keypad) 104 8 (keypad) 105 9 (keypad) 106 * (keypad) 109 (keypad) 109 - (keypad) 111 / (keypad) 112 F1 IE Used 113 F2 114 F3 IE Take Used 115 F4 IE Used 116 F5 IE Used 117 F6 IE Treated 118 F7 119 F8 120 F9 121 F10 Can't Can't remove the F11 Can't f12 Can't reach the Print Screen Sysrq 144 Numlock 145 Scroll Lock 186 :; 187 = 188 <, 189 - _ 190>. 191? / 192 `~ 219 {[220 | / 221}] 222"
Second, detect the control button at the same time:
Event.altKey True is the ALT key
Event.ctrlKey True is the Ctrl key
Event.shiftKey True is pressed the SHIFT button
Third, judgment function
/ / Whether the number key
Function isnumKey (nkey) {
IF (! Event.altKey &&! Event.ctrlkey &&! Event.shiftkey &&!
(nkey> = 48 && nkey <= 57 || nkey> = 96 && nkey <= 105)))
Return True;
Else
Return False;
}
// Whether the letter key
Function isalphakey (NKEY)
{
IF (! Event.altKey &&! Event.ctrlkey && Nkey> = 65 && nkey <= 90)
Return True;
Else
Return False;
}
/ / Whether the character key
Function ischarKey (Nkey)
{
IF (! Event.altkey &&! Event.ctrlKey && (Nkey> = 65 && nkey <= 90 ||
Nkey> = 48 && nkey <= 57 || nkey> = 96 && nkey <= 105 || nkey == 106 ||
nkey == 107 || nkey == 109 || nkey == 110 || nkey == 111 ||
Nkey> = 186 && nkey <= 192 || nkey> = 219 && nkey <= 222))
Return True;
Else
Return False;
}