Press any key to get corresponding code:
Key | Shift |
Code | 16 |
This prints the JavaScript codes for any key on your keyboard.
You can use the code number to assign an event to the key.
window.addEventListener('keydown', funcname, false);
function funcname(e) {
/* up */ if (e.keyCode === 38 ) { exec_if_pressed() }
/* dn */ if (e.keyCode === 40 ) { exec_if_pressed() }
/* $ */ if (e.keyCode === 220 ) { exec_if_pressed() }
// etc.
}