Method 1:
<html xmlns=” http://www.w3.org/1999/xhtml ” >
<head>
<title>Check Score</title>
<script language=”JavaScript”>
function keyLogin(){
If (event. keyCode==13)//The value of the Enter key is 13
Document. getElementByIdx_x ("input1 ″). click();//The login event that calls the login button
}
</script>
</head>
<body onkeydown=”keyLogin();”>
<input id="input1" value="Login" type="button" onClick="alert ('Call succeeded! ')">
</body>
</html>
Method 2:
<script>
function KeyDown()
{
if (event.keyCode == 13)
{
event.returnValue=false;
event.cancel = true;
Form1.btnsubmit.click();
}
}
</script>
Method 3:
Every website page has a login interface. Most of the time, after entering the user name and password, you need to click a button or link similar to login with the mouse, so that you can enter the website and do what you like
Sometimes I wonder if I can execute the login function after I input the things I should input, and then directly click Enter? The solution is as follows:
Ss.html Page code:
<html>
<head>
<title></title>
<meta http-equiv=”Content-Type” content=”text/html; charset=gb2312″>
<link rel=”stylesheet” href=”css/text.css” type=”text/css”>
</head>
<body bgcolor=”#FFFFFF” text=”#000000″ leftmargin=”0″ topmargin=”0″ marginwidth=”0″ marginheight=”0″ onkeydown=”on_return();”>
<form name =”loginForm” method=”post” action=”fuck.html”>
<table width=”100%” border=”0″ cellspacing=”0″ cellpadding=”0″>
<tr>
<td width="69%" height="30 ″><span class=" font_04 ″>Account Name</span>
<input type=”text” name=”userName” size=”18.5″>
</td>
</tr>
<tr>
<td width="69%" height="30 ″>Password</span>
<input type=”password” name=”pwd” >
</td>
</tr>
<tr>
<td width=”31%” height=”30″>
<a id=”sub” onClick=’check()’ >
Login</a></td>
</tr>
</table>
</form>
</body>
</html>
<script language=”javascript”>
function check() {
var formname=document.loginForm;
if (formname.userName.value == “”) {
Alert ("Please enter the user name!");
formname.userName.focus();
return false;
}
if (formname.pwd.value == “”) {
Alert ("Please enter the password!");
formname.pwd.focus();
return false;
}
formname.submit();
}
//When entering, the default is login
function on_return(){
if(window.event.keyCode == 13){
if (document.all(‘sub’)!= null){
document.all(‘sub’).click();
}
}
}
</script>