Changing variable after keypress?
<p>I'm trying to make a fun little game. </p>

<p>You have to press all the keys on the screen as fast as you can, without getting it wrong.</p>

<p>But struggling to change the variable after the first keypress. This is what I have:</p>

<pre><code>&lt;script language="JavaScript"&gt;
    document.onkeydown = checkKeycode;
    var uyhgg=13;
    function checkKeycode(e) {
        var keycode;
        if (window.event) {
            keycode = window.event.keyCode;
        } else if (e) {
            keycode = e.which;
        }            
        if (keycode == uyhgg){
            document.write(keycode);
        } else {
            alert("you hit the wrong key");
        }
    }
&lt;/script&gt;
</code></pre>

<p>Now after <code>document.write(keycode);</code> I want it to change the variable <code>uyhgg</code> (key code) to something else. 13 is enter. </p>
