exam_handle.asp
来自「数值计算方法网络课件系统是浙江大学过程装备与控制工程专业2001级本科生毕业设计」· ASP 代码 · 共 142 行
ASP
142 行
<!--#include file="inc/conn.asp"-->
<!--#include file="inc/func.asp"-->
<!--#include file="inc/md5.asp"-->
<%
'**************** 用户注册页面 *************
'* File: register.asp V1.0 2005.05.07
'* Author: wwxbei
'*******************************************
dim i, num
num=0
dim examTxt, txtL, txtR,txt
txtL=""
Call DBConnBegin()
Select Case Request.form("tixing")
Case "1"
Call handleChoice()
Case "2"
Call handleChoice2()
Case "3"
Call handleJudg()
Case "4"
Call handleFillin()
Case "5"
Call handleCalcul()
Case "6"
Call handleCalcul()
End Select
Call DBConnEnd()
Sub handleCalcul()
txtR="<div id='content1' style='text-align:left;'><h4>试题讲解</h4><p/>"
for i=1 to Request.Form("shuliang")
Sql = "select * from calculation where id="&CInt(Request.Form("id"&i))
set Rs= Conn.execute(Sql)
txt = "{theQNum}. {theQContent}<br>参考答案:{theAnswer}<br>你的答案:{theAns}<p />"
txt = replace(txt, "{theQNum}", i)
txt = replace(txt, "{theQContent}", Rs("question"))
txt = replace(txt, "{theAnswer}", Rs("answer"))
txt = replace(txt, "{theAns}", Request.Form("ans"&i))
txtR = txtR & txt
next
examTxt = FSOFileRead("html/exam_common.txt")
End Sub
Sub handleFillin()
txtR="<div id='content1' style='text-align:left;'><h4>试题讲解</h4><p/>"
for i=1 to Request.Form("shuliang")
Sql = "select * from fillin where id="&CInt(Request.Form("id"&i))
set Rs= Conn.execute(Sql)
txt = "{theQNum}. {theQContent}<br>参考答案:{theAnswer}<br>你的答案:{theAns}<p />"
txt = replace(txt, "{theQNum}", i)
txt = replace(txt, "{theQContent}", Rs("question"))
txt = replace(txt, "{theAnswer}", Rs("answer"))
txt = replace(txt, "{theAns}", Request.Form("ans"&i))
txtR = txtR & txt
next
examTxt = FSOFileRead("html/exam_common.txt")
End Sub
Sub handleJudg()
txtR="<div id='content' style='text-align:left;'><h4>试题讲解</h4><p/>"
for i=1 to Request.Form("shuliang")
Sql = "select * from judgment where id="&CInt(Request.Form("id"&i))
set Rs= Conn.execute(Sql)
if Rs("answer")=CBool(Request.Form("ans"&i)) then
txtL=txtL&"<tr><td>"&i&"</td><td colspan='2'>"&Rs("answer")&"</td></tr>"
num=num+1
else
txtL = txtL & "<tr><td>"&i&"</td><td>"&Rs("answer")&"</td><td>"&CBool(Request.Form("ans"&i))&"</td></tr>"
END IF
txt = "{theQNum}. {theQContent}<p />"
txt = replace(txt, "{theQNum}", i)
txt = replace(txt, "{theQContent}", Rs("question"))
txtR = txtR & txt
next
txtL="<div class='otherfrm'><h4>成绩统计</h4>正确:"&num&" 题<br>错误:"& i-num-1 &" 题</div><div class='otherfrm'><h4>成绩统计</h4><table border='1'><tr><td>题号</td><td>正确答案</td><td>你的答案</td></tr>"&txtL&"</table></div>"
examTxt = FSOFileRead("html/exam_common1.txt")
End Sub
Sub handleChoice()
txtR="<div id='content' style='text-align:left;'><h4>试题讲解</h4><p/>"
for i=1 to Request.Form("shuliang")
Sql = "select * from choice where id="&CInt(Request.Form("id"&i))
set Rs= Conn.execute(Sql)
if Rs("answer")=CInt(Request.Form("ans"&i)) then
txtL=txtL&"<tr><td>"&i&"</td><td colspan='2'>"&CBinToChar(Rs("answer"))&"</td></tr>"
num=num+1
else
txtL = txtL & "<tr><td>"&i&"</td><td>"&CBinToChar(Rs("answer"))&"</td><td>"&CBinToChar(Request.Form("ans"&i))&"</td></tr>"
END IF
txt = "{theQNum}. {theQContent}<br>A.{theA}B.{theB}C.{theC}D.{theD}<p />"
txt = replace(txt, "{theQNum}", i)
txt = replace(txt, "{theQContent}", Rs("question"))
txt = replace(txt, "{theA}", Rs("A"))
txt = replace(txt, "{theB}", Rs("B"))
txt = replace(txt, "{theC}", Rs("C"))
txt = replace(txt, "{theD}", Rs("D"))
txtR = txtR & txt
next
txtL="<div class='otherfrm'><h4>成绩统计</h4>正确:"&num&" 题<br>错误:"& i-num-1 &" 题</div><div class='otherfrm'><h4>成绩统计</h4><table border='1'><tr><td>题号</td><td>正确答案</td><td>你的答案</td></tr>"&txtL&"</table></div>"
examTxt = FSOFileRead("html/exam_common1.txt")
End Sub
Sub handleChoice2()
txtR="<div id='content' style='text-align:left;'><h4>试题讲解</h4><p/>"
for i=1 to Request.Form("shuliang")
Sql = "select * from choice where id="&CInt(Request.Form("id"&i))
set Rs= Conn.execute(Sql)
dim theans,ansi
theans=0
ansi= "ans"&i
For each ansi in Request.Form("ans"&i)
theans = CInt(theans) + CInt(ansi)
Next
if Rs("answer")=CInt(theans) then
txtL=txtL&"<tr><td>"&i&"</td><td colspan='2'>"&CBinToChar(Rs("answer"))&"</td></tr>"
num=num+1
else
txtL = txtL & "<tr><td>"&i&"</td><td>"&CBinToChar(Rs("answer"))&"</td><td>"&CBinToChar(CInt(theans))&"</td></tr>"
END IF
txt = "{theQNum}. {theQContent}<br>A.{theA}B.{theB}C.{theC}D.{theD}<p />"
txt = replace(txt, "{theQNum}", i)
txt = replace(txt, "{theQContent}", Rs("question"))
txt = replace(txt, "{theA}", Rs("A"))
txt = replace(txt, "{theB}", Rs("B"))
txt = replace(txt, "{theC}", Rs("C"))
txt = replace(txt, "{theD}", Rs("D"))
txtR = txtR & txt
next
txtL="<div class='otherfrm'><h4>成绩统计</h4>正确:"&num&" 题<br>错误:"& i-num-1 &" 题</div><div class='otherfrm'><h4>成绩统计</h4><table border='1'><tr><td>题号</td><td>正确答案</td><td>你的答案</td></tr>"&txtL&"</table></div>"
examTxt = FSOFileRead("html/exam_common1.txt")
End Sub
examTxt = replace(examTxt, "{theRightFrmContent}", txtR&"</div>")
examTxt = replace(examTxt, "{theLeftFrmContent}", txtL)
Response.write examTxt
%>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?