In this blog post, I will show how to get the value of keycode using a simple javascript code. Apart from this, I will also provide the list of keycode mapping
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Find KeyCode</title>
<script language="JavaScript">
function TriggeredKey(e) {
var keycode;
if (window.event) keycode = window.event.keyCode;
alert("keycode: " + keycode);
}
</script>
</head>
<body onkeydown="TriggeredKey(this)">
</body>
</html>
Special Keyboard Key(s) Code
KeyCode | |
---|---|
Backspace | 8 |
Tab | 9 |
Enter | 13 |
Shift | 16 |
Ctrl | 17 |
Alt | 18 |
Pause/Break | 19 |
Caps Lock | 20 |
Esc | 27 |
Page Up | 33 |
Page Down | 34 |
End | 35 |
Home | 36 |
Left Arrow | 37 |
Print Screen | 44 |
Delete | 46 |
F1 | 112 |
F2 | 113 |
F3 | 114 |
F4 | 115 |
F5 | 116 |
F6 | 117 |
F7 | 118 |
F8 | 119 |
F9 | 120 |
F10 | 121 |
F11 | 122 |
F12 | 123 |