document.onkeydown = function() { switch (window.event.keyCode) { case 37: alert('left'); break; case 38: alert('up'); break; case 39: alert('right'); break; case 40: alert('down'); break; } };
Read full article from keyboard events - Detecting arrow key presses in JavaScript - Stack Overflow
No comments:
Post a Comment