Determining keycode values

To determine the keycode value for a given key on the keyboard, save the following HTML code in a file and open it in an Internet Explorer browser window. The keycode value is displayed for any key pressed in that browser.

document.onkeydown = keydownhandler;
function keydownhandler()
	document.testform.displayField.value = "Keycode: " + window.event.keyCode;
		<form name="testform">
			<input type="text" name="displayField" value="Hit any key">