While the uuser is focused on a textbox, I want him to be able to press enter and run a certain function. Function calls from onkeydown in the text area work fine but this script doesn't seem to work. Here's what I have (basically ripped it off of w3schools)

I have absolutely no idea what's going on

Code:
function checkit()
	{
	var keynum
	var keychar
	if(window.event) // IE
			{
			keynum = e.keyCode
			}
		else if(e.which) // Netscape/Firefox/Opera
			{
			keynum = e.which
			}
	keychar = String.fromCharCode(keynum)
	document.write(keychar);
	}