[JavaScript] JS监控用户键盘按下事件获得按键编码 →→→→→进入此内容的聊天室

来自 , 2019-11-13, 写在 JavaScript, 查看 97 次.
URL http://www.code666.cn/view/342285bb
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script>
  5. function whichButton(event)
  6. {
  7. alert(event.keyCode);
  8. }
  9.  
  10. </script>
  11. </head>
  12.  
  13. <body onkeyup="whichButton(event)">
  14. <p><b>Note:</b> Make sure the right frame has focus when trying this example!</p>
  15. <p>Press a key on your keyboard. An alert box will alert the keycode of the key.</p>
  16. </body>
  17.  
  18. </html>
  19.  
  20. //javascript/7970

回复 "JS监控用户键盘按下事件获得按键编码"

这儿你可以回复上面这条便签

captcha