|
我想在注册的时候如果输入的用户名字小于3的时候用IF 和 msgbox 提示注册用户名字不能小于长度3
为什么错误!!!请指教下!!!
<script language="vbscript">
<!--
sub submit_onclick()
if len(login.userid.value)<3 then
msgbox"用户名太短,请选择有一个长度大于3的名字"
login.userid.select
exit sub
end if
if instr(trim(login.userid.value)," ")>1 then
msgbox"用户名请不要加入空格"
login.userid.select
exit sub
end if
if len(login.userpassword.value)<4 then
msgbox"密码太短,请选择有一个长度大于4的密码"
login.userpassword.select
exit sub
end if
if login.userpossword1.value<>login.possword.value then
msgbox"确认密码和密码不同,请确认"
login.userpassword.value=""
login.userpassword1.value=""
login.userpassword.select
exit sub
end if
if login.name.value="" then
msgbox"为了更好的为你服务,请输入你的名字"
login.name.select
exit sub
end if
if login.idnumber.value="" or Not isnumeric(login.idnumber.value) or len(login.idnumber.value)<>15 and len(login.idnumber.value)<>18 then
msbox "请输入你的身份证号码"
login.idnumber.select
exit sub
end if
if login.age.value="" or Not isnumeric(login.age.value) then
msbox "请正确输入你的年龄"
login.age.select
exit sub
else
if cint(login.age.value)<12 then
msbox "年龄输入范围有错"
login.age.select
exit sub
else
end if
if login.address.value="" then
msbox "请输入你的详细联系地址"
login.age.select
exit sub
else
end if
-->
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
.style5{font-size: 14px}
.style6{ color: #FF0000}
-->
</style>
</head>
<body leftmargin="20">
<span class="style5"><font color="#FF0000">你的位置:注册页面; 注意:带*的项目为必填项目</font></span>
<br>
<hr color="#999933" size="1" />
<br>
<form name="login" method="post" action="reg.asp" onsubmit="return chkform(this)">
<table width="617" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2" align="center" scope="col" height="30" bgcolor="#999999">*_*欢迎进入注册页面*_*</td>
</tr>
<tr>
<td width="30%" height="20"align="right">会员:</td>
<td width="70%"><input name="username" type="text" id="username" maxlength="18">
<span class="style6">*</span>(用户名长度为3-8位)</td>
</tr>
<tr>
<td align="right">密码:</td>
<td><input name="userpassword" type="password" id="userpassword" maxlength="18">
<span class="style6">*</span>(密码长度为6-8位)</td>
</tr>
<tr>
<td align="right">确认密码:</td>
<td><input name="userpassword1" type="password" id="userpassword1" maxlength="18">
</td>
</tr>
<tr>
<td align="right">你的姓名:</td>
<td><input name="name" type="text" id="name" maxlength="18"></td>
</tr>
<tr>
<td align="right">身份证号:</td>
<td><input name="idnumber" type="text" id="idnumber" maxlength="18"></td>
</tr>
<tr>
<td align="right">性 别:</td>
<td><input name="sex" type="text" id="sex" maxlength="18"></td>
</tr>
<tr>
<td align="right">你的年龄:</td>
<td><input name="age" type="text" id="age" maxlength="18"></td>
</tr>
<tr>
<td align="right">详细地址:</td>
<td><input name="address" type="text" id="address" maxlength="18" /></td>
</tr>
<tr>
<td align="right">邮政编码:</td>
<td><input name="zipcode" type="text" id="zipcode" maxlength="18"></td>
</tr>
<tr>
<td align="right">电话号码:</td>
<td><input name="phone" type="text" id="phone" maxlength="18" /></td>
</tr>
<tr>
<td align="right">电子邮箱:</td>
<td><input name="email" type="text" id="email" maxlength="18"></td>
</tr>
<tr>
<td height="15" align="right"><input type="submit" name="submit" value="注册" ></td>
<td align="left"> <input type="reset" name="submit" value="重置" /></td>
</tr>
</form>
</table>
</body>
</html> |
|