<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <script> window.onload = function(){ document.onkeydown = function(ev){ var oEvent = ev || event; alert(oEvent.keyCode); } } </script> </head> <body> </body> </html>