28,405
社区成员
发帖
与我相关
我的任务
分享<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML> <HEAD> <TITLE>一步一步提示表单验证 </TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<SCRIPT type=text/javascript>
function chkLogin(){
var username = document.showLogin.username.value;
var password = document.showLogin.password.value;
var email=document.showLogin.email.value.indexOf("@");
if(username.length < 1 || username.length > 30){
alert("用户名非法,请检查!");
return false;
}
if(password.length < 1 || password.length > 30){
alert("密码非法,请检查!");
return false;
}
if (email==-1){
alert("不是有效的电子邮件地址。")
return false;
}
return true
}
</SCRIPT>
<META content="MSHTML 6.00.2900.5803" name=GENERATOR> </HEAD>
<BODY>
<FORM name="showLogin" method="post" action="createPAD.asp" onSubmit="return chkLogin()">
用户名: <INPUt ype="text"T id="username" name="username" >
密码:<INPUT type="password" id="password" name="password">
电子邮件:<INPUT type="text" id="email" name="email">
<INPUT id="bottonFldsubmit" type="submit" value="Submit">
</FORM>
</BODY> </HTML>