南京浦口化粪池疏通:下面是ASP的一个检查代码,检查完再提交。可为什么不可以提交啊?

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/02 07:27:19
<script language="vbscript">
sub check()
if form.name.value=empty then
msgbox"请填写您的真实姓名!"
focusto(1)
exit sub
end if
if form.userid.value=empty then
msgbox"请填写您的ID号码!"
focusto(2)
exit sub
end if
if form.password1.value=empty then
msgbox"请设置您的登入密码!"
focusto(3)
exit sub
end if
if form.password2.value=empty then
msgbox"请确认您输入的密码!"
focusto(4)
exit sub
end if
if form.password1.value<>form.password2.value then
msgbox"您的密码设置有误!"
focusto(3)
exit sub
end if
if form.Email.value=empty then
msgbox"请填写您的Email地址!"
focusto(14)
exit sub
end if
if form.question.value=empty then
msgbox"请设置您的密码提示问题!"
focusto(16)
exit sub
end if
if form.answer.value=empty then
msgbox"请设置您的问题回答!"
focusto(17)
exit sub
end if
if instr(form.Email.value,"@")=0 then
msgbox"请正确设置你的Email地址!"
focusto(12)
exit sub
end if
form.Submit
Sub focusto(i)
document.form.elements(i).focus()
end sub
</script>
<body>
<h1 align="center">会员注册系统登入界面</h1>
<form name="form" method="post" action="Out.asp"id="form">
<h3><span class="STYLE1">*</span>用户名:
<label>
<input name="userid" type="text"id="userid"size="20">
</label>
</h3>
<h3><span class="STYLE1">*</span>密码:
<label>
<input name="password1" type="password"id="password1"size="20">
</label>
</h3>
<h3><span class="STYLE1">*</span>确认密码:
<label>
<input name="password2" type="password"id="password2"size="20">
</label>
</h3>
<h3>真实姓名:
<label>
<input name="name" type="text"id="name"size="20">
</label>
</h3>
<h3>
性别:
<label>
<select name="sex"id="sex" size="1">
<option>男</option>
<option>女</option>
</select>
</label>
</h3>
<h3>通信地址:
<label>
<input name="address" type="text"id="address"size="30">
</label>
邮编:
<label>
<input name="postnum" type="text"id="postnum"size="8">
</label>
</h3>
<h3>
<label></label>
<span class="STYLE1">*</span>电子邮件信箱:
<label>
<input name="Email" type="text"id="Email"size="20">
</label>
</h3>
<h3 class="STYLE1">*密码提示问题:</h3>
<p class="STYLE1">
<label>
<input name="question" type="text"id="question"size="30">
</label>
</p>
<h3 class="STYLE1">*你的回答:</h3>
<p class="STYLE1">
<label>
<input name="answer" type="text"id="answer"size="30">
</label>
</p>
<input type="button"name="按钮"value="按钮"onclick="check">
<input type="reset"name="reset"value="清空">
</form>
</body>

验证函数不能用VBSCRIPT写,要用JAVASCRIPT写,
然后再调用.
举个例子
<script language="javascript">
function check()
{

if (!checkspace(document.reg.userName.value))
{if(document.reg.userName.value.length<4)
{ alert("用户名长度不能小于4");
document.reg.userName.focus();
return false;
}}
else
{ alert("用户名不能全是空格");
document.reg.userName.focus();
return false;
}

if(document.reg.userPwd.value.length<6)
{ alert("密码长度不能小于6");
document.reg.userPwd.focus();
return false;
}
if(document.reg.userPwd.value!=document.reg.confirmPwd.value)
{
alert("两次密码输入不一致");
document.reg.userPwd.focus();
return false;
}

var email=/^[_a-z0-9]+@([_a-z0-9]+\.)+[a-z0-9]{2,3}$/;
if (!email.test(document.reg.email.value))
{ alert("电子邮件格式不正确");
document.reg.email.focus();
return false;
}

}
</script>

.....
<input type="button"name="按钮"value="按钮"onclick="return check();">