按键的键码是什么?
- <!DOCTYPE html>
- <html>
- <head>
- <script>
- function whichButton(event) {
- document.getElementById("demo").innerHTML = event.keyCode;
- }
- </script>
- </head>
- <body onkeyup="whichButton(event)">
- <p><b>注释:</b>尝试此示例时,请确保右框架具有焦点!</p>
- <p>单击此页面,然后按键盘上的键。</p>
- <p id="demo"></p>
- </body>
- </html>