document.onkeydown=keydown;
function keydown(event)
{
if ( !event )
event = window.event;
var keycode = event.KeyCode | event.Which;
alert(keycode);
}