网上看到用了一下,先记录在此

-生成4位验证码文件

<%
 dim getrandom
 Randomize
 getrandom=mid((rnd*100000),1,4)
 Session("getrandom")=getrandom
%>
-显示验证码及输入框文件
<input name="r_random" type="text" id="r_random" size="4" maxlength="4" autocomplete="off">
<img src="num/0<%=mid(getrandom,1,1)%>.gif" width="15" height="15" alt="">
<img src="num/0<%=mid(getrandom,2,1)%>.gif" width="15" height="15" alt="">
<img src="num/0<%=mid(getrandom,3,1)%>.gif" width="15" height="15" alt="">
<img src="num/0<%=mid(getrandom,4,1)%>.gif" width="15" height="15" alt="">
-检查验证码文件
<%
if Request.Form("r_random")<>Session("getrandom") then Response.Redirect("提示验证码出错文件")%>

附GIF数字图片/Files/allancandy/num.rar