Noninterrupting keyevents while preserving individual keystrokes
<p>I am designing a keyboard interface through javascript, and I want to define keystroke combinations, like shift+rightkey or ctrl+tab. But after tinkering with javascript, as seen <strong><a href="http://jsfiddle.net/Arcym/ENUj2/7/" rel="nofollow">here</a></strong>, I've noticed that all keyevents are interrupting. In the provided example, if you go to hit the shiftkey while holding down the rightkey, the functionality of the rightkey is interrupted!</p>

<pre><code>v = 1; /*v is the variable of velocity.*/

window.addEventListener("keydown", function(event)
{
    if(event.keyCode == 39) /*39 is the keycode of rightarrowkey.*/
    {
        //moves an element by the velocity.
        var keystroke = document.getElementById("keystroke");
        keystroke.style.left = parseInt(keystroke.style.left.slice(0,-2))+v+"px";
    }
    if(event.keyCode == 16) /*16 is the keycode of shift.*/
    {
         //increases the velocity of the element by four.
        document.getElementById("keystroke").style.borderColor = "red";
        v = 4;
    }
}, false); //but hitting the shiftkey while hitting the rightkey interrupts..!
</code></pre>

<p>I also experimented with recording all keystrokes through an object which is then iterated through at a designated interval for defined keystrokes, as seen <strong><a href="http://jsfiddle.net/Arcym/kjkCc/3/" rel="nofollow">here</a></strong>. But this system of handling the keyboard doesn't <em>preserve</em> the individual keystrokes; if I hit a key too fast, it may not be considered, or if I hold a key for too long, it may be overconsidered!</p>
