Greasemonkey Javascript Key Press

So after Googling for a good 30 minutes, I found out GreaseMonkey doesn't support onkeydown out of the box. I had to use a function called "addEventListener". My final code returns the keyCode of a key pressed on the site properly:

function KeyCheck(e)
{
alert(e.keyCode);
}

window.addEventListener('keydown', KeyCheck, true);

You shouldn't have the () after KeyCheck. Your current code runs KeyCheck and then attempts to set document.onKeyDown to the value returned. If you do it without the () it should instead set the function called KeyCheck to be run on the event.

Also, I think onKeyDown should be all lower case - it's document.onkeydown.

Further example, with an inline function:

document.onkeydown = function() { alert("key down") }

works whereas

document.onkeydown = alert("key down");

doesn't.