📄 createtest2.asp
字号:
<!--#include file="Check.asp"-->
<!--#include file="Conn.asp"-->
<%
Dim TeachingSujectID
TeachingSujectID = Session("TestTeachingSujectID")
Session("TestTeachingSujectID") = TeachingSujectID
%>
<%
TestName=Trim(Request.form("TestName"))
Subject=Trim(request.form("Subject"))
set rs=server.createobject("adodb.recordset")
Sql="select Subject,TestName from TestName where Subject='"&Subject&"' and TestName='"& TestName &"'"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if not rs.eof then
Response.Write "<script language=Javascript>alert('错误:以 ["&TestName&"] 为标题的自测类已经存在,请重新选择。谢谢!');history.go(-1);</script>"
Response.End
End If
rs.close
set rs=nothing
Sql="Select * from TestTopic where Subject='"&Subject&"' and TeachingSujectID ="&TeachingSujectID
Set oRs=Server.CreateObject("Adodb.RecordSet")
oRs.Open Sql,Conn,1,1
A=0
B=0
C=0
while not oRs.eof
Select Case oRs("Type")
Case "单选题"
A=A+1
Case "多选题"
B=B+1
Case "判断题"
C=C+1
End Select
oRs.MoveNext
Wend
oRs.Close()
Set oRs=Nothing
If request("Types")=2 Then'随机选择题
If A<=int(request("CountA")) and int(request("CountA"))>0 Then
Response.Write "<script>alert('错误(单选题):当随机选择时,随机选择数不能大于或等于最大该类题库数,\n现在数据库只存在该类选择题为 "&A&" 题,您所要求的是 "& request("CountA") &" 题');history.go(-1);</script>"
Response.End
End IF
IF B<=int(request("CountB")) and int(request("CountB"))>0 Then
Response.Write "<script>alert('错误(多选题):当随机选择时,随机选择数不能大于或等于最大该类题库数,\n现在数据库只存在该类选择题为 "&B&" 题,您所要求的是 "& request("CountB") &" 题');history.go(-1);</script>"
Response.End
End IF
IF C<=int(request("CountC")) and int(request("CountC"))>0 Then
Response.Write "<script>alert('错误(判断题):当随机选择时,随机选择数不能大于或等于最大该类题库数,\n现在数据库只存在该类选择题为 "&C&" 题,您所要求的是 "& request("CountC") &" 题');history.go(-1);</script>"
Response.End
End IF
End If
%>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>自测卷基本信息</title>
<script language="javascript">
function submitit(myform)
{
<%If Request.form("Types")=3 Then%>
if (myform.List2.length==0){alert("请选择题目!");return false;}
T=<%=request("CountA")%>+<%=request("CountB")%>+<%=request("CountC")%>
if (T!=myform.List2.length){alert("我很啰嗦的,好像不对:选题总数应该为"+T+" 题,而你选了 "+myform.List2.length+" 题!");return false;}
for (i=0;i<(myform.List2.length);i++)
{
myform.List2.options.item(i).selected=true;
}
<%End IF%>
if (confirm("确认无误?"))
{
myform.action="CreateTest3.asp";
return true;
}
else
return false;
}
sortitems = 1; // Automatically sort items within lists? (1 or 0)
function move(fbox,tbox) {
for(var i=0; i<fbox.options.length; i++) {
if(fbox.options[i].selected && fbox.options[i].value != "") {
var no = new Option();
no.value = fbox.options[i].value;
no.text = fbox.options[i].text;
tbox.options[tbox.options.length] = no;
fbox.options[i].value = "";
fbox.options[i].text = "";
}
}
BumpUp(fbox);
if (sortitems) SortD(tbox);
}
function BumpUp(box) {
for(var i=0; i<box.options.length; i++) {
if(box.options[i].value == "") {
for(var j=i; j<box.options.length-1; j++) {
box.options[j].value = box.options[j+1].value;
box.options[j].text = box.options[j+1].text;
}
var ln = i;
break;
}
}
if(ln < box.options.length) {
box.options.length -= 1;
BumpUp(box);
}
}
function SortD(box) {
var temp_opts = new Array();
var temp = new Object();
for(var i=0; i<box.options.length; i++) {
temp_opts[i] = box.options[i];
}
for(var x=0; x<temp_opts.length-1; x++) {
for(var y=(x+1); y<temp_opts.length; y++) {
if(temp_opts[x].text > temp_opts[y].text) {
temp = temp_opts[x].text;
temp_opts[x].text = temp_opts[y].text;
temp_opts[y].text = temp;
temp = temp_opts[x].value;
temp_opts[x].value = temp_opts[y].value;
temp_opts[y].value = temp;
}
}
}
for(var i=0; i<box.options.length; i++) {
box.options[i].value = temp_opts[i].value;
box.options[i].text = temp_opts[i].text;
}
}
</script>
<link rel="stylesheet" type="text/css" href="css.css">
<style type="text/css">
<!--
body,td,th {
font-size: 12px;
}
body {
background-color: #B1DB99;
}
-->
</style></head>
<body>
<table width="100%" height="18" border="0" cellspacing="1"0 bgcolor="#D9ECFF" id="AutoNumber2" style="border-collapse: collapse">
<tr>
<td width="100%" background="../images/Down_bg.gif"> ★ <strong>当前位置: <font color="#FF0000">生成自测(步骤二)</font></strong></td>
</tr>
</table>
<br>
<table border="1" cellpadding="0" cellspacing="1" style="border-collapse: collapse" id="AutoNumber1" width="100%" bordercolor="#C0C0C0">
<form method="POST" name="secondform" action="CreateTest2.asp" onSubmit="return submitit(secondform);">
<tr height="20">
<td colspan="4" bgcolor="#D9ECFF"> <p align="center"><font color="#666666"><b>试卷基本信息</b></font></td>
</tr>
<tr height="20">
<td bgcolor="#F4FAFF" width="120"> <p align="center"><b>选择类别</b></td>
<td > <input type="text" name="Subject" size="20" value="<%=request("Subject")%>" class="inputnormal" readonly></td>
<td><p align="center"><b>填入标题:</b></p></td>
<td align=center><input type=text name=TestName size="18" class="inputnormal" onBlur="this.className='inputnormal'" onFocus="this.className='inputedit';this.select()" value="<%=TestName%>" readonly></td>
</tr>
<tr align="center" height="20">
<td colspan="4" bgcolor="#D9ECFF"><font color="#666666"><b>试卷说明</b></font></td>
</tr>
<tr height="20">
<td bgcolor="#F4FAFF"> <p align="center"><b>试卷说明:</b></td>
<td colspan="3" > <textarea name="Intro" cols="60" rows="6" class="inputnormal" onBlur="this.className='inputnormal'" onFocus="this.className='inputedit';this.select()" ></textarea></td>
</tr>
<tr height="20">
<td colspan="4" bgcolor="#D9ECFF"> <p align="center"><font color="#666666"><b>试卷信息</b></font></td>
</tr>
<tr height="20">
<td align="center" bgcolor="#F4FAFF"><b>卷面总分(<font color="#FF0000">分</font>)</b></td>
<td colspan="3"> <p align="left">
<input type="text" name="TotalResult" size="20" value="<%=request("TotalResult")%>" class="inputnormal" readonly>
</td>
</tr>
<tr height="20">
<td align="center" bgcolor="#D9ECFF"><font color="#666666"> </font></td>
<td bgcolor="#D9ECFF"> <p align="center"><font color="#666666"><b>单选题</b></font></td>
<td bgcolor="#D9ECFF"> <p align="center"><font color="#666666"><b>多选题</b></font></td>
<td bgcolor="#D9ECFF"> <p align="center"><font color="#666666"><b>判断题</b></font></td>
</tr>
<tr height="20">
<td align="center" bgcolor="#F4FAFF"><b>题型分布(<font color="#FF0000">个</font>)</b></td>
<td> <p align="center">
<input type="text" name="CountA" size="12" value="<%=request("CountA")%>" class="inputnormal" readonly>
</td>
<td> <p align="center">
<input type="text" name="CountB" size="12" value="<%=request("CountB")%>" class="inputnormal" readonly>
</td>
<td> <p align="center">
<input type="text" name="CountC" size="12" value="<%=request("CountC")%>" class="inputnormal" readonly>
</td>
</tr>
<tr height="20">
<td align="center" bgcolor="#F4FAFF"><b>分值分布(<font color="#FF0000">分</font>)</b></td>
<td> <p align="center">
<input type="text" name="ResultA" size="12" value="<%=request("ResultA")%>" class="inputnormal" readonly>
</td>
<td> <p align="center">
<input type="text" name="ResultB" size="12" value="<%=request("ResultB")%>" class="inputnormal" readonly>
</td>
<td> <p align="center">
<input type="text" name="ResultC" size="12" value="<%=request("ResultC")%>" class="inputnormal" readonly>
</td>
</tr>
<tr height="20">
<td align="center" bgcolor="#F4FAFF"><b>选题方式</b></td>
<td colspan=3>
<% Types=Request.form("Types") %>
<select name=Types disabled=1>
<option value=1 <%If Types=1 then Response.Write "Selected"%>>最新题目方式</option>
<option value=2 <%If Types=2 then Response.Write "Selected"%>>随机选择方式</option>
<option value=3 <%If Types=3 then Response.Write "Selected"%>>自由组合方式</option>
</select> <input type=hidden name=Types value="<%=Types%>"> </td>
</tr>
<%If Types=3 then%>
<tr>
<td width="120" colspan="5"> <table border="0">
<tr>
<td><select multiple size="10" name="List1">
<%
Sql="Select ID,Question,Type from TestTopic where Subject='"&Subject&"' and TeachingSujectID = " &TeachingSujectID& " order by Type asc"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
i=0
while Not rs.eof
i=i+1
Question=Trim(rs(1))
L=Len(Question)
T=12
If L>T Then
Question=Left(Question,T)&"("& rs(2) &").."
Else
Question=Question&"("& rs(2) &")"
End If
Response.Write "<option value='"& rs(0) &"'>"& i &"."& Question &"</option>"
rs.MoveNext
Wend
rs.close()
Set rs=Nothing
%>
</select></td>
<td> <input type="button" value=" >> " onClick="move(this.form.List1,this.form.List2)" name="B1" class="b2">
<br> <BR> <input type="button" value=" << " onClick="move(this.form.List2,this.form.List1)" name="B2" class="b2">
</td>
<td><select multiple size="10" name="List2">
</select></td>
</tr>
</table></td>
</tr>
<%End If%>
<tr align="right" height="20">
<td colspan="4"> <input type="button" value="上一步>>" name="B12" class="b2" onClick="Javascript:history.go(-1);">
<input type="submit" value="下一步>>" name="B1" class="b2"> </td>
</tr>
</form>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -