1.
1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 4 <html xmlns="http://www.w3.org/1999/xhtml" > 5 <head> 6 <title>Check Score</title> 7 <script language="JavaScript"> 8 function keyLogin(){ 9 if (event.keyCode==13) //回车键的键值为13 10 document.getElementById("input1").click(); //调用登录按钮的登录事件,执行click事件 11 } 12 </script> 13 </head> 14 <body onkeydown="keyLogin();"> 15 <input id="input1" value="登录" type="button" onclick="alert('调用成功!')"> 16 </body> 17 </body> 18 </html>