First:
Copy codeThe Code is as follows:
<Script type = "text/javascript">
Function check (form ){
If (form. userId. value = ''){
Alert ("enter your account! ");
Form. userId. focus ();
Return false;
}
If (form. password. value = ''){
Alert ("Enter your logon password! ");
Form. password. focus ();
Return false;
}
Return true;
}
</Script>
<Form action = "login. do? Act = login "method =" post ">
User Account
<Input type = text name = "userId" size = "18" value = "">
<Br>
Logon Password
<Input type = "password" name = "password" size = "19" value = ""/>
<Input type = submit name = "submit1" value = "login" onclick = "return check (this. form)">
</Form>
Second
Copy codeThe Code is as follows:
<Script type = "text/javascript">
Function check (form ){
If (form. userId. value = ''){
Alert ("enter your account! ");
Form. userId. focus ();
Return false;
}
If (form. password. value = ''){
Alert ("Enter your logon password! ");
Form. password. focus ();
Return false;
}
Return true;
}
</Script>
<Form action = "login. do? Act = login "method =" post "onsubmit =" return check (this) ">
User Account
<Input type = text name = "userId" size = "18" value = "">
<Br>
Logon Password
<Input type = "password" name = "password" size = "19" value = ""/>
<Input type = submit name = "submit1" value = "login">
</Form>
Third:
Copy codeThe Code is as follows:
<Script type = "text/javascript">
Function check (form ){
If (form. userId. value = ''){
Alert ("enter your account! ");
Form. userId. focus ();
Return false;
}
If (form. password. value = ''){
Alert ("Enter your logon password! ");
Form. password. focus ();
Return false;
}
Document. myform. submit ();
}
</Script>
<Form action = "login. do? Act = login "name =" myform "method =" post ">
User Account
<Input type = text name = "userId" size = "18" value = "">
<Br>
Logon Password
<Input type = "password" name = "password" size = "19" value = ""/>
<Input type = button name = "submit1" value = "login" onclick = "check (this. form)">
</Form>