need help to display letter pressed in a div with javascript
<p>here's what i got so far, i get "undefined" in the div instead of the actual letter pressed.</p>

<pre><code>&lt;script language="JavaScript"&gt;
    document.onkeydown = checkKeycode;

    function checkKeycode(e) 
    {
        var keycode;
        if (window.event) 
        {
            keycode = window.event.keyCode;
        }
        else if (e) keycode = e.which;

        var character = String.fromCharCode(keycode);
        var letterDiv = document.getElementById("letter1");
        letterDiv.innerHTML =character.innerHTML;
&lt;/script&gt;
</code></pre>
