设为首页收藏本站

新微赢技术网

 找回密码
 注册
搜索
热搜: 回贴
查看: 65|回复: 3
打印 上一主题 下一主题

求助 一个ASP考试程序的判卷问题

[复制链接]
跳转到指定楼层
1#
发表于 2010-1-9 03:56:12 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
我是这样写的 但多选题判分却不准
<%
'开始统计答对的题数
ycorrect=0
rsCount=1
id1=0
response.write "<hr color=purple>"
response.write"<br>单选结果统计:"
response.write "<hr color=purple>"
do while not id1>400
id1=id1+1
id=request.form("id"&id1)
if id<>"" then
sql8="select * from test where id='"&id1&"'"
response.write "<br>"
response.write "<b>题号:"&id1
response.write "<br>"
response.write "题目"
Set rs8=server.createobject("adodb.recordset")
rs8.open sql8,conn,1,3
da=rs8("ans")
tm=rs8("question")
a=rs8("a")
b=rs8("b")
c=rs8("c")
d=rs8("d")
e=rs8("e")
f=rs8("f")
response.write rscount
response.write "."&tm
response.write "</b><br>"
response.write "<hr>"
if a<>"" then
response.write "A."&a&"<br>"
end if
if b<>"" then
response.write "B."&b&"<br>"
end if
if c<>"" then
response.write "C."&c&"<br>"
end if
if d<>"" then
response.write "D."&d&"<br>"
end if
if e<>"" then
response.write "E."&e&"<br>"
end if
if f<>"" then
response.write "F."&f&"<br>"
end if
response.write "<br>"
response.write "<hr>"
response.write "正确答案:"&da
response.write "<br>"
da1=request.form("ans"&rscount)
response.write "你选择的答案:"&da1&"<br><br>"
response.write "<hr>"
if id=rs8("id") then
ys="#0066cc"
if request.form("ans"&rscount)=rs8("ans") then
ys="#FFFFFF"
ycorrect=ycorrect+1
else
rscount=rscount+1
end if
end if
end if
loop
response.write "<font color=#4e2972>单选题共得"&ycorrect
response.write "分<br>"
response.write "共"&rscount
response.write "道题"
response.write "<br>"
response.write "共答对"&ycorrect
response.write "道题</font><br>"
rs8.close
set rs8=nothing
%>
<%
ycorrect2=0
rsCounts=61
id2=0
response.write "<hr color=purple>"
response.write"<br>多选结果统计:"
do while not id2>500
id2=id2+1
id3=request.form("ids"&id2)
if id3<>"" then
sql9="select * from test where id='"&id3&"'"
response.write "<br>"
response.write "<hr color=purple>"
response.write "<b>题号:"&id3
response.write "<br>"
response.write "题目"
Set rs9=server.createobject("adodb.recordset")
rs9.open sql9,conn,1,3
da2=rs9("ans")
tm=rs9("question")
a=rs9("a")
b=rs9("b")
c=rs9("c")
d=rs9("d")
e=rs9("e")
f=rs9("f")
response.write rscounts-60
response.write "."&tm
response.write "</b><hr>"
response.write "<br>"
if a<>"" then
response.write "A."&a&"<br>"
end if
if b<>"" then
response.write "B."&b&"<br>"
end if
if c<>"" then
response.write "C."&c&"<br>"
end if
if d<>"" then
response.write "D."&d&"<br>"
end if
if e<>"" then
response.write "E."&e&"<br>"
end if
if f<>"" then
response.write "F."&f&"<br>"
end if
response.write "<hr>"
response.write "<br>"
response.write "正确答案"&da2
response.write "<br>"
y=", "
y1=""
da3=replace((request.form("dns"&rscounts)),y,y1)
rs9s=cstr(rs9("ans"))
response.write "你选择的答案:"&da3
response.write "<br><br>"
response.write "<hr>"
if id2=rs9("id") then
if cstr(da3)=rs9s then
ycorrect2=ycorrect2+1
rscount2=rscounts+1
else
rscount2=rscounts+1
end if
end if
end if
loop
rscounts=rscounts-60
response.write "<font color=#4e2972>多选题共得"&ycorrect2
response.write "分<br>"
response.write "共"&rscounts
response.write "道题"
response.write "<br>"
response.write "共答对"&ycorrect2
response.write "道题</font>"
%>
前面的单选题判分是正常的 但后面的多选就不正常了 分数永远都是0不知道哪错了 高手出来帮个忙   

补充一下 数据库中的答案是文本型的 格式是abc出题页面是用CHECKBOX来做的 输出的是a, b, c我用replace替换掉了多余的字符
可是运行后的结果是


正确答案abc
你选择的答案:abc

多选题共得0分
共1道题
共答对0道题
2#
发表于 2010-1-9 03:56:16 | 只看该作者
你的循环语句写错了,上面使用do while not id2>500开始循环
下面就不能单独 loop
而是
movenext
loop
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

申请友链|小黑屋|最新主题|手机版|新微赢技术网 ( 苏ICP备08020429号 )  

GMT+8, 2024-11-19 06:23 , Processed in 0.101169 second(s), 9 queries , Gzip On, Memcache On.

Powered by xuexi

© 2001-2013 HaiAn.Com.Cn Inc. 寰耽

快速回复 返回顶部 返回列表