去评论
dz插件网

js控制键盘按键(回车、空格)

哥斯拉
2022/03/04 15:11:02
[HTML]  
  1. < html xmlns = "http://www.w3.org/1999/xhtml" >
  2. < head >
  3. < title >Check Score</ title >
  4. < script language = "JavaScript" >
  5. function keyLogin(){
  6.   if (event.keyCode==13)  //回车键的键值为13
  7.     document.getElementByIdx_x("input1").click(); //调用登录按钮的登录事件
  8. }
  9. </ script >
  10. </ head >
  11. < body >
  12. < input id = "input1" value = "登录" type = "button" >
  13. </ body >
  14. </ html >