WORKING WITH JAVASCRIPT KEY EVENT
We can get the keycode in key events like onkeyup, onkeydown, onClick, onKeypress.....
We can get the keycode in key events like onkeyup, onkeydown, onClick, onKeypress.....
window.onkeyup = function (event) {
if(event.keyCode == 38 || event.which == 38){
// here you can put your up arrow functionality code
}else if(event.keyCode == 40 || event.which == 40){
// here you can put your down arrow functionality code
}
if (event.keyCode == 27 || event.which == 27) {
// here you can put your esc key functionality code
like window.close();
}
}
|
|
|
No comments:
Post a Comment