js控制键盘按键(回车、空格)
[HTML]
- < html xmlns = "http://www.w3.org/1999/xhtml" >
- < head >
- < title >Check Score</ title >
- < script language = "JavaScript" >
- function keyLogin(){
- if (event.keyCode==13) //回车键的键值为13
- document.getElementByIdx_x("input1").click(); //调用登录按钮的登录事件
- }
- </ script >
- </ head >
- < body >
- < input id = "input1" value = "登录" type = "button" >
- </ body >
- </ html >