This seems to fire every keypress. It displays the keycode in the status bar.
If your code still doesn't work, you'll have to post it.
Code:
<script>
function showKey() {
    window.status = event.keyCode;
}
</script>
<input size=10 onkeypress=showKey()>