exam_question.asp
来自「数值计算方法网络课件系统是浙江大学过程装备与控制工程专业2001级本科生毕业设计」· ASP 代码 · 共 151 行
ASP
151 行
<!--#include file="inc/conn.asp"-->
<!--#include file="inc/func.asp"-->
<!--#include file="inc/md5.asp"-->
<!--#include file="inc/sqlin.asp"-->
<%
'**************** 用户注册页面 *************
'* File: register.asp V1.0 2005.05.07
'* Author: wwxbei
'*******************************************
dim examTxt, txtL, txtR
txtR = "<div id='content1' style='text-align:left;'><h4>随机试卷</h4><form method='post' action='exam_handle.asp'>"
dim dataTable(6)
dataTable(0)=""
dataTable(1)="choice"
dataTable(2)="choice"
dataTable(3)="judgment"
dataTable(4)="fillin"
dataTable(5)="calculation"
dataTable(6)="calculation"
Call DBConnBegin()
Sql = "select * from "&dataTable(CInt(Request.form("tixing")))&" where type="&CInt(Request.form("tixing"))
if Request.form("chapter")<>"0" then
Sql = Sql & " and chapter="&CInt(Request.form("chapter"))
end if
if Request.form("difficulty")<>"0" then
Sql = Sql & " and difficulty='"&Request.form("difficulty")&"'"
end if
dim txt,n,count,num,i
Rs.open Sql,conn,1,1
count=CInt(Rs.recordcount)
n=CInt(Request.form("shuliang"))
IF n > Count Then
num=split(CStr(GetRndNum(Count,Count)),",")
txtR = txtR & "<font color=red>注意:您要求的题目数量超出了题库内符合条件的题目数量!</font><br><br>"
else
num=split(CStr(GetRndNum(n,Count)),",")
End IF
Select Case Request.form("tixing")
Case "1"
Call listChoice()
Case "2"
Call listChoice2()
Case "3"
Call listJudg()
Case "4"
Call listFillin()
Case "5"
Call listCalcul()
Case "6"
Call listCalcul()
End Select
Call DBConnEnd()
txtR = txtR & "<input type='hidden' name='tixing' value="&Request.Form("tixing")&">"
Sub listChoice()
for i = 1 to ubound(num)
Rs.move CInt(num(i))-1
txt = "<p/>{theQNum}. {theQContent}<br><input type='radio' name='ans{theQNum}' value='1' />A.{theA}<input type='radio' name='ans{theQNum}' value='10' />B.{theB}<input type='radio' name='ans{theQNum}' value='100' />C.{theC}<input type='radio' name='ans{theQNum}' value='1000' />D.{theD}<input type='hidden' name='id{theQNum}' value='{theID}' /><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"))
txt = replace(txt, "{theID}", Rs("id"))
txtR = txtR & txt
Rs.movefirst
next
End Sub
Sub listChoice2()
for i = 1 to ubound(num)
Rs.move CInt(num(i))-1
txt = "<p/>{theQNum}. {theQContent}<br><input type='checkbox' name='ans{theQNum}' value='1' />A.{theA}<input type='checkbox' name='ans{theQNum}' value='10' />B.{theB}<input type='checkbox' name='ans{theQNum}' value='100' />C.{theC}<input type='checkbox' name='ans{theQNum}' value='1000' />D.{theD}<input type='hidden' name='id{theQNum}' value='{theID}' /><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"))
txt = replace(txt, "{theID}", Rs("id"))
txtR = txtR & txt
Rs.movefirst
next
End Sub
Sub listJudg()
for i = 1 to ubound(num)
Rs.move CInt(num(i))-1
txt = "<p/>{theQNum}. {theQContent}<br><input type='radio' name='ans{theQNum}' value='1' />正确 <input type='radio' name='ans{theQNum}' value='0' />错误<input type='hidden' name='id{theQNum}' value='{theID}' /><p />"
txt = replace(txt, "{theQNum}", i)
txt = replace(txt, "{theQContent}", Rs("question"))
txt = replace(txt, "{theID}", Rs("id"))
txtR = txtR & txt
Rs.movefirst
next
End Sub
Sub listFILLin()
for i = 1 to ubound(num)
Rs.move CInt(num(i))-1
txt = FSOFileRead("html/exam_calcul.txt")
txt = replace(txt, "{theQNum}", i)
txt = replace(txt, "{theQContent}", Rs("question"))
txt = replace(txt, "{theID}", Rs("id"))
txtR = txtR & txt
Rs.movefirst
next
End Sub
Sub listCalcul()
for i = 1 to ubound(num)
Rs.move CInt(num(i))-1
txt = FSOFileRead("html/exam_calcul.txt")
txt = replace(txt, "{theQNum}", i)
txt = replace(txt, "{theQContent}", Rs("question"))
txt = replace(txt, "{theID}", Rs("id"))
txtR = txtR & txt
Rs.movefirst
next
End Sub
dim number
if n<Count then
number=n
else
number=Count
end if
txtR = txtR & "<p /><input type='hidden' name='shuliang' value='"& number &"'/><input type='submit' value='.提 交.'><input type='reset' value='.重 置.'></form></div>"
txtL = FSOFileRead("html/exam_left.txt")
examTxt = FSOFileRead("html/exam_common.txt")
examTxt = replace(examTxt, "{theRightFrmContent}", txtR)
examTxt = replace(examTxt, "{theLeftFrmContent}", txtL)
Response.write examTxt
%>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?