I have a keydown event that starts a timer and clears it onkeyup.
The problem is that when you hold down the key, it acts like you're typing and repeats so rapidly that the timer clears before it calls.
This is the actual code:
Code:
var tm1;
function Move(....)
{
...
}
function srt(evt)
{
tm1=setInterval("Move("+event.keyCode+")",100);
....
}
function end()
{
clearInterval(tm1)
}
document.onkeydown=srt;
document.onkeyup=end;
Any ideas on how to prevent the repeat or fix the code for it to not accept the rapid repeats?