看看这ASP中的代码那错了,没法验证啊

来源:百度知道 编辑:UC知道 时间:2024/06/15 02:16:14
<script language="javascript" type="text/javascript">
function judge()
{

if (document.form1.userpwd1.value=="")
{alert("请输入你的密码");
document.form1.userpwd1.focus()
document.form1.userpwd1.select()
return false;}

if (document.form1.userpwd2.value!=document.form1.userpwd1.value)
{alert("两次输入密码不一致,请重新输入");
document.form1.userpwd1.focus()
document.form1.userpwd1.select()
return false;}

if (document.form1.userpwd1.value.length<4||document.form1.userpwd1.value.length>8)
{alert("请输入4-8位的密码");
document.form1.userpwd1.focus()
document.form1.userpwd1.select()
return false;}

if (document.form1.nickname.value=="")
{alert("请输入你的昵称");
document.form1.nickname.focus()
document.form1.nickname.select()
return false;}

var regx=/^\d{2,2}$/;
if(!regx.tes

var mailstr;
mailstr=document.form1.mail.value;
if (mailstr.indexOf("@")==-1 || mailstr="")
{alert("请输入你正确的E-mail地址");
document.form1.mail.focus()
document.form1.mail.select()
return false;}

上面那段JS代码有错

if (mailstr.indexOf("@")==-1 || mailstr="")
改成
if (mailstr.indexOf("@")==-1)
或者if (mailstr.indexOf("@")==-1 || (mailstr=""))
就行了