Keycode in JavaScript

xiaoxiao2021-03-14  194

KEYCODE

KeyCode can be used to set up or get a Unicode character that causes the keyboard event.

English help is described as: Sets or Retrieves The Unicode Key Code Associated with The key That Caused The event.

two. Unicode Key Code Control

Common characters are as follows:

48 0 button 73 I key

49 1 button 74 J key

50 2 key 75 k

51 3 key

76 L

key

52 4 key

77 m

key

53 5 key 78 n keys

54 6 key 79 o

55 7 key 80 p

56 8 key 81 q key

57 9 key 82 r

65 a

Key 83 S button

66 B key 84 t key

67 C

Key 85 U key

68 D button 86 V key

69 E key 87 w button

70 f

Key 88 X key

71 g

Key 89 Y key

72 h key 90 z key

Or by http://www.chinaue.com/tool/uni.htm inquiry,

3. Mask keyboard by Keycode

When the user is input on the interface, it is possible to associate the JavaScript code through the event onkeypress or onkeyup to determine the current keyboard code, such as:

1 Shield non-numeric key:

Function checkKeycode ()

{

IF (Window.Event.Keycode> 57 || WINDOW.EVENT.KEYCODE <48)

{

Window.event.keycode = 0;

}

}

}

2 shielded F5 key