📄 exam.asp
字号:
<?xml version="1.0" encoding="gb2312"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%
'防止用户浏览器缓存页面
response.buffer=true '设置web服务器使用缓冲页
response.expiresabsolute=now()-1 '指定页面的过期时间(单间日期时间)
response.expires=0 %>
<!---由模板生成试卷前对试卷信息进行更详细设置--->
<!---#include file="conn.asp"--->
<link href="main.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>考试</title>
</head>
<body>
<%
set rst=conn.execute("select * from TestPaper where IsCurrent=1")
TianKongNum=rst("TianKongNum")
TianKongScore=rst("TianKongScore")
PanDuanNum=rst("PanDuanNum")
PanDuanScore=rst("PanDuanScore")
DanXuanNum=rst("DanXuanNum")
DanXuanScore=rst("DanXuanScore")
JianDaNum=rst("JianDaNum")
JianDaScore=rst("JianDaScore")
TestPaperId=rst("id")
TestPaperName=rst("TestPaperName")
'检测此考生是滞已参过此次考试
set rstTmp=conn.execute("select id from StuTestPaper where TestPaperName='"&TestPaperName&"' and StuId="&Session("StuId"))
if(not rstTmp.eof) then
response.Write("<script language='javascript'>alert('你已参加过此次考试!');history.go(-1);</script>")
end if
rstTmp.close()
set rstTmp=nothing
dim t
t=array("一、","二、","三、","四、","五、")
tn=0
%>
<div align="center"><font color="#FF0000"><%=rst("TestPaperName")%>考试</font></div>
<form name="form1" method="post" action="ExamOver.asp">
<!---存储必要数据提交给生成页使用--->
<input name="TestPaperName" type="hidden" value="<%=rst("TestPaperName")%>"/>
<input name="StuId" type="hidden" value="<%=Session("StuId")%>"/>
<INPUT name="TianKongNum" type="hidden" value="<%=TianKongNum%>" />
<INPUT name="PanDuanNum" type="hidden" value="<%=PanDuanNum%>" />
<INPUT name="DanXuanNum" type="hidden" value="<%=DanXuanNum%>" />
<INPUT name="JianDaNum" type="hidden" value="<%=JianDaNum%>" />
<INPUT name="TianKongScore" type="hidden" value="<%=TianKongScore%>" />
<INPUT name="PanDuanScore" type="hidden" value="<%=PanDuanScore%>" />
<INPUT name="DanXuanScore" type="hidden" value="<%=DanXuanScore%>" />
<INPUT name="JianDaScore" type="hidden" value="<%=JianDaScore%>" />
<table width="800" border="1" align="center" cellpadding="1" cellspacing="0" bordercolorlight="#ffffff" bordercolordark="#CCCCCC">
<tr><td>
<%
'填空题开始
if(TianKongNum<>0)then
set rst=conn.execute("select count(*) as c from ExamTianKong where TestPaperId="&TestPaperId)
if(cint(rst("c"))<>TianKongNum) then
response.write("<font color='red'>填空题题量不足,如有问题请联系管理员!</font>")
response.end()
end if
set rst=conn.execute("select * from ExamTianKong where TestPaperId="&TestPaperId&" order by Id")
strtype=t(tn)&"填空题。共"&TianKongNum*TianKongScore&"分("&TianKongNum&"道*"&TianKongScore&"分)<br>"
response.write(strtype)
n=0
while not rst.eof
n=n+1
str=" "&n&"、"&rst("question")&"<br> 请填写答案:<input type='text' name='TianKongStuAnswer"&n&"' size='40'/><br>"
response.write(str)
response.write("<INPUT name='TianKongAnswer"&n&"' type='hidden' value='"&rst("answer")&"' />")
rst.movenext
str=""
wend
tn=tn+1
end if
'填空题结束
response.write("</td></tr><tr><td>")
'判断题开始
if(PanDuanNum<>0)then
set rst=conn.execute("select count(*) as c from ExamPanDuan where TestPaperId="&TestPaperId)
if(cint(rst("c"))<>PanDuanNum) then
response.write("<font color='red'>判断题题量不足,如有问题请联系管理员!</font>")
response.end()
end if
set rst=conn.execute("select * from ExamPanDuan where TestPaperId="&TestPaperId&" order by Id")
strtype=t(tn)&"判断题。共"&PanDuanNum*PanDuanScore&"分("&PanDuanNum&"道*"&PanDuanScore&"分)<br>"
response.write(strtype)
n=0
while not rst.eof
n=n+1
str=" "&n&"、"&rst("question")&" 请选择答案:<select name='PanDuanStuAnswer"&n&"'><option value='空' selected='selected'>空</option>"
str=str&"<option value='1'>对</option><option value='0'>错</option></select><br>"
response.write(str)
response.write("<INPUT name='PanDuanAnswer"&n&"' type='hidden' value='"&rst("answer")&"' />")
rst.movenext
str=""
wend
tn=tn+1
end if
'判断题结束
response.write("</td></tr><tr><td>")
'单选题开始
if(DanXuanNum<>0)then
set rst=conn.execute("select count(*) as c from ExamDanXuan where TestPaperId="&TestPaperId)
if(cint(rst("c"))<DanXuanNum) then
response.write("<font color='red'>单选题题量不足,如有问题请联系管理员!</font>")
response.end()
end if
set rst=conn.execute("select top "&DanXuanNum&" * from ExamDanXuan where TestPaperId="&TestPaperId&" order by Id")
strtype=t(tn)&"单选题。共"&DanXuanNum*DanXuanScore&"分("&DanXuanNum&"道*"&DanXuanScore&"分)<br>"
response.write(strtype)
n=0
while not rst.eof
n=n+1
str=" "&n&"、"&rst("question")&" 请选择答案:<select name='DanXuanStuAnswer"&n&"'><option value='空' selected='selected'>空</option><option value='A'>A</option><option value='B'>B</option><option value='C'>C</option><option value='D'>D</option></select><br>"
str=str&" A、"&rst("a")&" B、"&rst("b")&"<br>"
if(rst("c")<>"") then
str=str&" C、"&rst("c")
if(rst("d")<>"") then
str=str&" D、"&rst("d")&"<br>"
else
str=str&"<br>"
end if
end if
response.write(str)
response.write("<INPUT name='DanXuanAnswer"&n&"' type='hidden' value='"&rst("answer")&"' />")
rst.movenext
str=""
wend
tn=tn+1
end if
'单选题结束
response.write("</td></tr><tr><td>")
'简答题开始
if(JianDaNum<>0)then
set rst=conn.execute("select count(*) as c from ExamJianDa where TestPaperId="&TestPaperId)
if(cint(rst("c"))<JianDaNum) then
response.write("<font color='red'>简答题题量不足,如有问题请联系管理员!</font>")
response.end()
end if
set rst=conn.execute("select top "&JianDaNum&" * from ExamJianDa where TestPaperId="&TestPaperId&" order by id")
strtype=t(tn)&"简答题。共"&JianDaNum*JianDaScore&"分("&JianDaNum&"道*"&JianDaScore&"分)<br>"
response.write(strtype)
n=0
while not rst.eof
n=n+1
str=" "&n&"、"&rst("question")&"<br> 请填写答案:<br> <textarea name='JianDaStuAnswer"&n&"' cols='80' rows='11'></textarea><br>"
response.write(str)
response.write("<INPUT name='JianDaQuestion"&n&"' type='hidden' value='"&rst("question")&"' />")
response.write("<INPUT name='JianDaAnswer"&n&"' type='hidden' value='"&rst("answer")&"' />")
rst.movenext
str=""
wend
tn=tn+1
end if
'简答题结束
rst.close()
conn.close()
set rst=nothing
set conn=nothing
%>
</td>
</tr>
<tr>
<td align="center"><input type="submit" name="Submit" value="提交" onclick="return confirm('确定要提交吗?');"/>
<input type="reset" name="Submit2" value="重置" onclick="return confirm('确定要重置吗?');"/> </td>
</tr>
</table>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -