<form action="?action=sub" method="post" name="myform">
<div>
<input name="s" type="radio" value="s1" />yingzi001.cn
<input name="s" type="radio" value="s2" />pc1w.com
<input name="s" type="radio" value="s3" />pc1w.cn
</div>
<div>
请回答:<input name="s4" type="text" value="" />
</div>
<div>
<input name="sub" type="submit" value="提交答案" />
</div>
</form>
<%
if request("action")="sub" then
%>
<%
if request("s")="s1" and request("s4")="pc1w.com" then
response.Write("回答正确")
else
response.Write("回答错误")
end if
%>
<%end if%>
<div>
说明: 当答案 选中yingzi001.cn 且 输入的答案为 pc1w.com 时 通过<br>
回答正确那,你自己加上奖励的代码就可以了。
</div>
<%
wt="你是谁|你在哪|你几岁|我的网站是"
da="小罗|深圳|22|stu.fjtjw.com"
'以上问题和答案对应
wts=split(wt,"|")
das=split(da,"|")
randomize
sn=rnd()*ubound(wts) '取出一个问题的编号,也就是数组里的位置
action=request("action")
if action="wd" then
myda=request("myda") '这里是接收填写的答案 暂时不用,我替换成直接的,
snid=request("snid")
if myda<>"" then
if cstr(myda)=cstr(das(snid)) then
response.write "正确"
else
response.write "错误"
' response.redirect"rndwd.asp"
end if
else
response.write "答案不能为空"
end if
end if
%>
<table width="292" height="75" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><%response.write wts(sn) '打印问题%> </td>
</tr>
<tr>
<td><form name="form1" method="post" action="">
<label>
<input name="myda" type="text" id="myda"> 答案:<%=cstr(das(snid))%>
</label>
<label>
<input type="submit" name="Submit" value="提交">
</label>
<input name="action" type="hidden" id="action" value="wd">
<input name="snid" type="hidden" id="snid" value="<%=sn%>">
</form> </td>
</tr>
</table>