Javascript examples for DOM:Key Event
Display key code during pressing document
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){// w w w .j a v a2s.c o m document.addEventListener("keydown", keyDown, false); function keyDown(e) { document.getElementById("key").innerHTML = e.keyCode; } } </script> </head> <body> <p id="key"></p> </body> </html>