Edit The Code:
See Result »
Try it Yourself - ©
w3big.com
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>本教程(w3big.com)</title> <script> function whichButton(event){ alert(event.keyCode); } </script> </head> <body onkeyup="whichButton(event)"> <p><b>注释:</b>在测试这个例子时,要确保右侧的框架获得了焦点。</p> <p>在键盘上按一个键。消息框会提示出该按键的 unicode。</p> </body> </html>