大话西游手游敏男人:asp数字验证的问题

来源:百度文库 编辑:神马品牌网 时间:2024/04/28 13:27:24
<% ycodenum=4
for i=1 to ycodenum
Randomize
ycode=ycode&Int((9*Rnd))
next
response.write ycode
%>此段产生一个验证码
后面判断怎么写
<% if yan<>ycode 'yan为文本输入,要判断如果输入的码不对就跳出提示框提示
补充一个条件yan为空或不等于ycode时

<% ycodenum=4
for i=1 to ycodenum
Randomize
ycode=ycode&Int((9*Rnd))
next
response.write ycode
%>

<script language="javascript">

if(yan!=<%=ycode %>){

alert("验证码错误!");
return false;

}

</script>

注:楼上的方法在弹出对话框后点确定后退,验证码就不刷新了。

if yan<>ycode then

Response.Write("<script>alert='验证码错误!';window.location.href='#'</script>")

Response.End()

End if

if yan<>ycode then

Response.Write("<script language=""javascript"">alert(""验证码错误!"");history.go(-1);</script>")

Response.End()

end if