<%
dim rndnum,verifycode
Randomize
Do While Len(rndnum)<4
num1=CStr(Chr((57-48)*rnd+48))
rndnum=rndnum&num1
loop
session("verifycode")=rndnum
%>
<%
'首先判断输入的验证码是否正确
dim verifycode1,verifycode2
verifycode1=trim(Request.Form("verifycode1"))
verifycode2=trim(Request.Form("verifycode2"))
if verifycode1<>verifycode2 then
response.write"<SCRIPT language=JavaScript>alert('您输入的验证码不正确。');"
response.write"location.href='index.asp'</SCRIPT>"
else
session("verifycode")=""
%>
<tr>
<td align="center" height=30>验证码:<input name="verifycode1" id="verifycode1" style="border-style:solid;border-width:1;padding-left:4;padding-right:4;padding-top:1;padding-bottom:1" onFocus="this.select(); " οnmοuseοver="this.style.background='#EAEAEA';" οnmοuseοut="this.style.background='#FFFFFF'" size="12" maxlength="4">
<font color="#000000" size="2"><%=session("verifycode")%>
<input type="hidden" name="verifycode2" value="<%=session("verifycode")%>"></td>
</tr>