验证码的问题,高分求解!!!

wdmcsoft 2009-03-29 12:35:30
哪位高手帮我看看这个验证码的问题,输错的情况下,还能继续提交!!!

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><%=webname%></title>
<script type="text/javascript">
function checkEmail(Cid,Cvalue)
{
var namepass=false;
//var zemail = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
namepass = (Cvalue.indexOf('@') > 0 && Cvalue.indexOf('@')!=Cvalue.length-1 && Cvalue.indexOf('.') > 1 && Cvalue.indexOf('.')!=Cvalue.length-1);
var infoList = document.getElementById(Cid);
if(namepass)
{
infoList.innerHTML = "<div id=\"e1\" class=\"uname_right\" style=\"display:inline\"> <font color=\"258404\">填写正确!</font></div>";

//YTreg.checkName(name,getAjaxClient_callBackonsubmit);
}
else
{
infoList.innerHTML = "<div id=\"e1\" class=\"uname_err\" style=\"display:inline\"> <font color=\"FF0000\">邮箱格式错误!</font></div>";

}
}
function Checkcode(Cid,Cvalue)
{
var infoList = document.getElementById(Cid);
var role = <%=Session("chkcode")%>;
var a = document.getElementById("a20").value;
if(a =="")
{
infoList.innerHTML = "<div id=\"e1\" class=\"uname_err\" style=\"display:inline\"> <font color=\"FF0000\">验证码不能为空!</font></div>";


}

else if(a!=role)
{
infoList.innerHTML = "<div id=\"e1\" class=\"uname_err\" style=\"display:inline\"> <font color=\"FF0000\">输入的验证码不一致!</font></div>";


}

else if(a==role){
infoList.innerHTML = "<div id=\"e1\" class=\"uname_right\" style=\"display:inline\"> <font color=\"258404\">验证码输入正确!</font></div>";

return true;
}
}

function checkItem(zy,Vlen,Cid,Cvalue,errorTxt)
{
//<div id="usererr1" class="uname_right" style="display:none"> <font color="258404">填写正确!</font></div>
//<div id="V1" class="uname_err" style="display:none"> <font color="FF0000">2-16位字母,数字非敏感字符</font></div>

var namea = Cvalue; //注:此处不能用 document.getElementById(); 不然验证会出错!
var badChar ="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
badChar += "abcdefghijklmnopqrstuvwxyz";
badChar += "0123456789";

var boolean = false;
var zifu = true;
var namepass = false;
namepass = ((namea != "") && (namea.length>0 && namea.length<Vlen));
var infoList = document.getElementById(Cid);
if(namepass)
{

if(zy=="1") //只能为自己定义的字符集
{
var patrn= /[\u4E00-\u9FA5]|[\uFE30-\uFFA0]/gi;
if (!patrn.exec(namea))
{
infoList.innerHTML = "<div id=\"e1\" class=\"uname_right\" style=\"display:inline\"> <font color=\"258404\">填写正确!</font></div>";
}
else
{
infoList.innerHTML = "<div id=\"e1\" class=\"uname_err1\" style=\"display:inline\"> <font color=\"FF0000\">"+errorTxt+"</font></div>";
}
}
else
{
infoList.innerHTML = "<div id=\"e1\" class=\"uname_right\" style=\"display:inline\"> <font color=\"258404\">填写正确!</font></div>";

}
//YTreg.checkName(name,getAjaxClient_callBackonsubmit);
}
else
{
infoList.innerHTML = "<div id=\"e1\" class=\"uname_err\" style=\"display:inline\"> <font color=\"FF0000\">"+errorTxt+"</font></div>";

}
return namepass;
}



function tijiao()
{
var abc = true;
var leixing1 = document.getElementById("leixing1");
if(leixing1.checked==true)
{

checkItem(1,18,'V14',document.getElementById("a14").value,'邮箱错误')
checkItem(1,18,'V24',document.getElementById("a20").value,'验证码错误')


abc = (checkItem(1,21,'V14',document.getElementById("a14").value,'邮箱错误') && checkItem(1,21,'V24',document.getElementById("a20").value,'验证码错误'));

if(abc!=false)
{
myform.submit();
}

}


}

</script>

</head>

<body>

<% '提交到数据库的操作
if request("aaa")="1" then
response.write"提交数据库"
end if
%>


<table width="418" border="0" cellpadding="0" cellspacing="0" class="table">
<tr>
<td width="158" height="33"><div align="right"><strong>选择注册类型</strong>:</div></td>
<td width="260"><div align="center">
<input name="leixing" id="leixing1" type="radio" value="1" checked="checked" onclick="ChangeItem(1)" />
<span class="red"><strong>个人用户</strong></span>   
<input type="radio" name="leixing" id="leixing2" value="2" onclick="ChangeItem(2)" />
<span class="red"><strong>企业用户</strong></span> </div></td>
</tr>
</table>
<form name="myform" method="post" action="">
<table width="686" border="0" cellpadding="10" cellspacing="0" class="table" id="single" style="display:inline">
<tr>
<td width="158" height="28" rowspan="2" bgcolor="#FFFFFF"><div align="right"><strong>邮 箱</strong>:<strong> </strong><span class="red">*</span></div></td>
<td width="260" rowspan="2" bgcolor="#FFFFFF"> <input name="a14" type="text" id="a14" onfocus="checkItem(1,21,'V14',this.value,'邮箱错误');checkEmail('V88',this.value)" onblur="checkItem(1,21,'V14',this.value,'邮箱错误');checkEmail('V88',this.value)"maxlength="21" /> </td>
<td width="268" height="28" bgcolor="#FFFFFF"><span id="V14"></span></td>
</tr>
<tr>
<td height="28" bgcolor="#FFFFFF"><span id="V88"></span></td>
</tr>
</table>
<table width="686" height="52" border="0" cellpadding="0" cellspacing="0" class="table">
<tr>
<td width="158"><div align="right"><strong>验证码</strong>: <span class="red">*</span></div></td>
<td width="260"> <input name="a20" type="text" id="a19" onfocus="" onblur="Checkcode('V24',this.value);" size="12" maxlength="4" /> <img src="net/img.asp" width="40" height="15" border="0" /></td>
<td width="268"><span id="V24"></span></td>
</tr>
<tr>
<td colspan="3"><div align="center"> <input type="button" name="Submit" value=" 提交 " onclick="tijiao();" />
</div></td>
</tr>
</table></form>


</body>
</html>
...全文
74 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
lzj34 2009-04-21
  • 打赏
  • 举报
回复
你的验证完了,后都没有返回值一直走到底肯定得出的结果是真真
街头小贩 2009-04-21
  • 打赏
  • 举报
回复
验证码能用正则匹配!第一次看到!
Trinx 2009-04-20
  • 打赏
  • 举报
回复
我初学者,学习学习!
kangjial 2009-04-20
  • 打赏
  • 举报
回复
这个用AJAX很简单就可以实现的,建议你去问一下AJAX的
wdmcsoft 2009-03-29
  • 打赏
  • 举报
回复
忘了加网址了

http://www.rc0359.com/reg2.asp
wdmcsoft 2009-03-29
  • 打赏
  • 举报
回复
我现在用的是AJAX来实现错误提示

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧