⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testpaperpreviw.asp

📁 在线考试系统
💻 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>
<script language="JavaScript">
function formsubmit(){
	if(confirm("确定要生成吗?")){
	form2.submit();
	}
}
</script>
<%
 '防止用户浏览器缓存页面
 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>
<!---
获取模板中各题型的数量及分值,从各题型中选择出指定数量的试题,显示出来。
使用隐藏域,存储随机选择出来的试题ID,提交给生成页面,插入试卷的各题型中。
使用另一个Form存储重新生成的数据。
--->
</head>
<body onload="window.focus();">
<%
TestPaperName=request.form("TestPaperName")
'检测试卷表中是否已有此试卷名称

set rst=conn.execute("select id from TestPaper where TestPaperName='"&TestPaperName&"'")
if( not rst.eof) then
response.write("<script language='javascript'>alert('现有试卷中已有此试卷名称,\n请重新命名!');window.close();</script>")
response.end()
end if
CategoryId=request.form("category")
Length=request.form("length")
Score=request.form("Score")
TestPaperTempletId=request.querystring("id")
set rst=conn.execute("select * from TestPaperTemplet where id="&TestPaperTempletId)
TianKongNum=rst("TianKongNum")
TianKongScore=rst("TianKongScore")
PanDuanNum=rst("PanDuanNum")
PanDuanScore=rst("PanDuanScore")
DanXuanNum=rst("DanXuanNum")
DanXuanScore=rst("DanXuanScore")
DuoXuanNum=0
DuoXuanScore=0
JianDaNum=rst("JianDaNum")
JianDaScore=rst("JianDaScore")

dim t
t=array("一、","二、","三、","四、","五、")
tn=0
%>
<div align="center"><font color="#FF0000"><%=TestPaperName%>试卷预览</font></div>
<form name="form1" method="post" action="TestPaperCreate.asp"> 
<!---存储必要数据提交给生成页使用--->
<INPUT name="TestPaperName" type="hidden" value="<%=TestPaperName%>" />
<INPUT name="CategoryId" type="hidden" value="<%=CategoryId%>" />
<INPUT name="Length" type="hidden" value="<%=Length%>" />
<INPUT name="Score" type="hidden" value="<%=Score%>" />
<INPUT name="TianKongNum" type="hidden" value="<%=TianKongNum%>" />
<INPUT name="TianKongScore" type="hidden" value="<%=TianKongScore%>" />
<INPUT name="PanDuanNum" type="hidden" value="<%=PanDuanNum%>" />
<INPUT name="PanDuanScore" type="hidden" value="<%=PanDuanScore%>" />
<INPUT name="DanXuanNum" type="hidden" value="<%=DanXuanNum%>" />
<INPUT name="DanXuanScore" type="hidden" value="<%=DanXuanScore%>" />
<INPUT name="DuoXuanNum" type="hidden" value="<%=DuoXuanNum%>" />
<INPUT name="DuoXuanScore" type="hidden" value="<%=DuoXuanScore%>" />
<INPUT name="JianDaNum" type="hidden" value="<%=JianDaNum%>" />
<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 TKTianKong where CategoryId="&CategoryId)
	if(cint(rst("c"))<TianKongNum) then
	response.write("<font color='red'>题量不足,如有问题请联系管理员!</font>")
	response.end()
	end if
	set rst=conn.execute("select top "&TianKongNum&" * from TKTianKong where CategoryId="&CategoryId&" order by newid()")
	strtype=t(tn)&"填空题。共"&TianKongNum*TianKongScore&"分("&TianKongNum&"道*"&TianKongScore&"分)<br>"
	response.write(strtype)
	n=0	
	while not rst.eof
	n=n+1
	str="&nbsp;&nbsp;&nbsp;&nbsp;"&n&"、"&rst("question")&"<br>&nbsp;&nbsp;&nbsp;&nbsp;请填写答案:<input type='text' name='tk"&n&"' size='40'/><br>"
	response.write(str)	
	response.write("<INPUT name='TianKong"&n&"' type='hidden' value='"&rst("id")&"' />")
	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 TKPanDuan where CategoryId="&CategoryId)
	if(cint(rst("c"))<PanDuanNum) then
	response.write("<font color='red'>题量不足,如有问题请联系管理员!</font>")
	response.end()
	end if
	set rst=conn.execute("select top "&PanDuanNum&" * from TKPanDuan where CategoryId="&CategoryId&" order by newid()")
	strtype=t(tn)&"判断题。共"&PanDuanNum*PanDuanScore&"分("&PanDuanNum&"道*"&PanDuanScore&"分)<br>"
	response.write(strtype)
	n=0	
	while not rst.eof
	n=n+1
	str="&nbsp;&nbsp;&nbsp;&nbsp;"&n&"、"&rst("question")&"&nbsp;&nbsp;请选择答案:<select name='select'><option value='空' selected='selected'>空</option>"
	str=str&"<option value='对'>对</option><option value='错'>错</option></select><br>"
	response.write(str)	
	response.write("<INPUT name='PanDuan"&n&"' type='hidden' value='"&rst("id")&"' />")
	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 TKDanXuan where CategoryId="&CategoryId)
	if(cint(rst("c"))<DanXuanNum) then
	response.write("<font color='red'>题量不足,如有问题请联系管理员!</font>")
	response.end()
	end if
	set rst=conn.execute("select top "&DanXuanNum&" * from TKDanXuan where CategoryId="&CategoryId&" order by newid()")
	strtype=t(tn)&"单选题。共"&DanXuanNum*DanXuanScore&"分("&DanXuanNum&"道*"&DanXuanScore&"分)<br>"
	response.write(strtype)
	n=0	
	while not rst.eof
	n=n+1	
	str="&nbsp;&nbsp;&nbsp;&nbsp;"&n&"、"&rst("question")&"&nbsp;&nbsp;请选择答案:<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&"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A、"&rst("a")&"&nbsp;B、"&rst("b")&"<br>"
	if(rst("c")<>"") then
	str=str&"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;C、"&rst("c")
		if(rst("d")<>"") then
		str=str&"&nbsp;D、"&rst("d")&"<br>"
		else
		str=str&"<br>"
		end if
	end if
	response.write(str)	
	response.write("<INPUT name='DanXuan"&n&"' type='hidden' value='"&rst("id")&"' />")
	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 TKJianDa where CategoryId="&CategoryId)
	if(cint(rst("c"))<JianDaNum) then
	response.write("<font color='red'>题量不足,如有问题请联系管理员!</font>")
	response.end()
	end if
	set rst=conn.execute("select top "&JianDaNum&" * from TKJianDa where CategoryId="&CategoryId&" order by newid()")
	strtype=t(tn)&"简答题。共"&JianDaNum*JianDaScore&"分("&JianDaNum&"道*"&JianDaScore&"分)<br>"
	response.write(strtype)
	n=0	
	while not rst.eof
	n=n+1
	str="&nbsp;&nbsp;&nbsp;&nbsp;"&n&"、"&rst("question")&"<br>&nbsp;&nbsp;&nbsp;&nbsp;请填写答案:<br>&nbsp;&nbsp;&nbsp;&nbsp;<textarea name='JianDaStuAnswer'"&n&" cols='80' rows='11'></textarea><br>"
	response.write(str)	
	response.write("<INPUT name='JianDa"&n&"' type='hidden' value='"&rst("id")&"' />")
	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"> <a href="#" onclick="form1.submit();">确认生成</a>&nbsp;&nbsp;&nbsp;<a href="#" onclick="form2.submit();">重新生成</a> 
      </td>
    </tr>
  </table>
  </form>
 <FORM action="TestPaperPreviw.asp?id=<%=TestPaperTempletId%>" method="post" name="form2">
<INPUT name="TestPaperName" type="hidden" value="<%=TestPaperName%>" />
<INPUT name="category" type="hidden" value="<%=CategoryId%>" />
<INPUT name="Length" type="hidden" value="<%=Length%>" />
<INPUT name="Score" type="hidden" value="<%=Score%>" />
</FORM>

</body>
</html>
<!---
'多选题开始
if(DuoXuanNum<>0)then
	set rst=conn.execute("select count(*) as c from TKDuoXuan where CategoryId="&CategoryId)
	if(cint(rst("c"))<DuoXuanNum) then
	response.write("<font color='red'>题量不足,如有问题请联系管理员!</font>")
	response.end()
	end if
	set rst=conn.execute("select top "&DuoXuanNum&" * from TKDuoXuan where CategoryId="&CategoryId&" order by newid()")
	strtype=t(tn)&"多选题。共"&DuoXuanNum*DuoXuanScore&"分("&DuoXuanNum&"道*"&DuoXuanScore&"分)<br>"
	response.write(strtype)
	n=0	
	while not rst.eof
	n=n+1	
	str="&nbsp;&nbsp;&nbsp;&nbsp;"&n&"、"&rst("question")&"<br>"
	str=str&"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A、"&rst("a")&"&nbsp;B、"&rst("b")&"<br>"
	if(rst("c")<>"") then
	str=str&"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;C、"&rst("c")
		if(rst("d")<>"") then
		str=str&"&nbsp;D、"&rst("d")&"<br>"
		else
		str=str&"<br>"
		end if
	end if
	if(rst("e")<>"") then
	str=str&"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;E、"&rst("e")
		if(rst("f")<>"") then
		str=str&"&nbsp;&nbsp;F、"&rst("f")&"<br>"
		else
		str=str&"<br>"
		end if
	end if
	if(rst("g")<>"") then
	str=str&"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;G、"&rst("g")
		if(rst("h")<>"") then
		str=str&"&nbsp;&nbsp;H、"&rst("h")&"<br>"
		else
		str=str&"<br>"
		end if
	end if	
	response.write(str)	
	response.write("<INPUT name='DuoXuan"&n&"' type='hidden' value='"&rst("id")&"' />")
	rst.movenext
	str=""
	wend 
	tn=tn+1
end if
'多选题结束
--->

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -