document.onkeydown = function(event){ var event = (window.event) ? window.event.keyCode : event.which; switch(event){ case : //...; break; } };