Yes, you're stuck. You can emulate the behavior you want using timers until you get the appropriate keyup , but this obviously will not use the user's computer keyboard repeat settings.
The following code uses the above method. The code that you want to handle with key change events (both real and simulated) should go to handleKeyDown :
var keyDownTimers = {}; var keyIsDown = {}; var firstKeyRepeatDelay = 1000; var keyRepeatInterval = 100; function handleKeyDown(keyCode) { if (keyCode == 38) { alert("Up"); } } function simpleKeyDown(evt) { evt = evt || window.event; var keyCode = evt.keyCode; handleKeyDown(keyCode); } document.onkeydown = function(evt) { var timer, fireKeyDown; evt = evt || window.event; var keyCode = evt.keyCode; if ( keyIsDown[keyCode] ) {
source share