document.onkeypress not working
<p>Is there any reason the following code should not return anything in my console log?!</p>

<pre><code>document.onkeypress =  zx();


function zx(){
console.log(event.keyCode);
} // zx
</code></pre>

<p><code>window.onkeypress</code> also doesn't work.</p>

<p>Other attempts has been made, like these:</p>

<pre><code>document.onkeypress =  zx(event);


function zx(event){
console.log(event.keyCode);
} // zx
</code></pre>

<p>-</p>

<pre><code>    document.onkeypress =  zx;


    function zx(){
    console.log(event.keyCode);
    } // zx
</code></pre>

<p>Thanks!</p>
