window.captureEvents(Event.onkeydown); window.onkeydown= pressed; function pressed(e) { alert(e.which)}