document.onkeydown = checkShortcuts;
function checkShortcuts(event) {
document.getElementById("action").innerHTML = event.keyCode;
}
<html>
<head></head>
<body>
<div>Key Code: <span id="action">Press any key...</span>
</div>
</body>
</html>