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

📄 paper_add.asp

📁 这是一个用ASP写的在线考试系统.特别一点 就是考试试卷有两种考法,一种为系统自动出卷,另一种是老师出卷考试.前者的实现是参考网上代码.总的来说还是很值得参考的.
💻 ASP
字号:
<!--#include file="conn2.asp"-->
<!--#include file="loginv.asp"-->
 <%
if not VerificationRole("ROLE_1") then
	response.Write("<p>&nbsp;</p><center><img src='img/error.gif'></center>")
	response.End()
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>在线考试系统</title>
<script language="javascript">
function checktotal(){
var myform=document.firstform;
var a=myform.singlecount.value;
var b=myform.singleper.value;
var c=myform.multicount.value;
var d=myform.multiper.value;
var e=myform.judgecount.value;
var f=myform.judgeper.value;
var i=myform.totalper.value;
var j=a*b+c*d+e*f;
if (j!=i){
  document.all.tishi.innerText=" 当前卷面总分:"+ j +",卷面总分与设定的不相符,请修改卷面总分或者调整题型分布和分值分布!";
  }
else
  document.all.tishi.innerText=" 当前卷面总分:"+ j;
}

function submitit(){
var myform;
myform=document.firstform;
if (myform.subject.value==""){
  alert("请选择考试科目!")
  myform.subject.focus();
  return false;
  }
else
  return true;
if (j!=i){
  alert("设定的总分和卷面总分不相符,请修改卷面总分或者调整题型分布和分值分布!");
  return false;
  }
else 
  return true;
}
</script>
<link href="css/Style.css" rel="stylesheet" type="text/css">
</head>

<body onload="checktotal();">

 
 
<TABLE width="500" border=0 align=center cellPadding=2 cellSpacing=1 
                  bgColor=#d2ebff class="Xsmall">
  
       
    <TR>
      <TD vAlign=top bgColor=#ffffff>
        <TABLE cellSpacing=0 cellPadding=0 width="100%" 
border=0>
          <TBODY>
            <TR>
              <TD 
                              height=25 background=img/backt.gif class="Xsmall"> 后台随机组卷</TD>
            </TR>
          </TBODY>
        </TABLE>
      </TD>
    </TR>
    
  
       <TD vAlign=top bgColor=#ffffff><table width="500" border="0" align="center" cellpadding="0" cellspacing="0" class="Xsmall">              
  <form method="POST" action="paper_save.asp" name="firstform" onsubmit="return submitit();">
 

       
     <tr height="20">
      <td width="128" style="font-size: 9pt; color: #000000"  >
      <p align="center">选择科目</td>
      <td width="855" colspan="3" bgcolor="#FFFFFF" style="font-size: 9pt; color: #000000">        <strong>
        <select size="1" name="subject">
              <option selected>选择科目</option>
              <% sql="select * from tryinfo1"
      set rs=server.createobject("adodb.recordset")
      rs.open sql,conn,3,2
      do while not rs.eof %>
              <option value="<%=rs("db_name")%>"><%=rs("db_name")%></option>
              <% rs.movenext
      loop
      rs.close %>
        </select>
      </strong> </td>
     </tr>
	 
    <tr   height="20">
      <td colspan="4" style="font-size: 9pt;  ">
      <p align="center"><strong>后台组卷</strong></td>
    </tr>
    <tr height="20">
      <td width="138" style="font-size: 9pt; color: #000000" align="center"  >
          卷面总分(<font color="#FF0000">分</font>)</td>
      <td bgcolor="#FFFFFF" style="font-size: 9pt; color: #000000">
      <p align="center"><strong>
        <input type="text" name="totalper" size="18" class="inputnormal" onkeyup="if(isNaN(this.value)) this.value='10';" onblur="this.className='inputnormal'" onfocus="this.className='inputedit';this.select()" value="100">
      </strong></td>
      <td colspan="2" bgcolor="#FFFFFF" id="tishi" style="font-size: 9pt; color: #000000"><strong> </strong></td>
    </tr>
    <tr   height="20">
      <td width="128" style="font-size: 9pt; color: #000000" align="center"><strong> </strong></td>
      <td style="font-size: 9pt; color: #000000">
      <p align="center"><strong>单选题</strong></td>
      <td style="font-size: 9pt; color: #000000">
      <p align="center"><strong>多选题</strong></td>
      <td style="font-size: 9pt; color: #000000">
      <p align="center"><strong>判断题</strong></td>
    </tr>
    <tr height="20">
      <td width="128" style="font-size: 9pt; color: #000000" align="center"  >
          题型分布(<font color="#FF0000">个</font>)</td>
      <td width="195" bgcolor="#FFFFFF" style="font-size: 9pt; color: #000000">
      <p align="center"><strong>
        <input type="text" name="singlecount" size="18" class="inputnormal" onkeyup="if(isNaN(this.value)) this.value='10';" onblur="this.className='inputnormal';checktotal();" onfocus="this.className='inputedit';this.select()" value="10">
      </strong></td>
      <td width="330" bgcolor="#FFFFFF" style="font-size: 9pt; color: #000000">
      <p align="center"><strong>
        <input type="text" name="multicount" size="18" class="inputnormal" onkeyup="if(isNaN(this.value)) this.value='15';" onblur="this.className='inputnormal';checktotal();" onfocus="this.className='inputedit';this.select()" value="15">
      </strong></td>
      <td width="328" bgcolor="#FFFFFF" style="font-size: 9pt; color: #000000">
      <p align="center"><strong>
        <input type="text" name="judgecount" size="18" class="inputnormal" onkeyup="if(isNaN(this.value)) this.value='10';" onblur="this.className='inputnormal';checktotal();" onfocus="this.className='inputedit';this.select()" value="10">
      </strong></td>
    </tr>
    <tr height="20">
      <td width="128" style="font-size: 9pt; color: #000000" align="center"  >
          分值分布(<font color="#FF0000">分</font>)</td>
      <td width="195" bgcolor="#FFFFFF" style="font-size: 9pt; color: #000000">
      <p align="center"><strong>
        <input name="singleper" size="18" class="inputnormal" onkeyup="if(isNaN(this.value)) this.value='2';" onblur="this.className='inputnormal';checktotal();" onfocus="this.className='inputedit';this.select()" value="2">
      </strong></td>
      <td width="330" bgcolor="#FFFFFF" style="font-size: 9pt; color: #000000">
      <p align="center"><strong>
        <input type="text" name="multiper" size="18" class="inputnormal" onkeyup="if(isNaN(this.value)) this.value='4';" onblur="this.className='inputnormal';checktotal();" onfocus="this.className='inputedit';this.select()" value="4">
      </strong></td>
      <td width="328" bgcolor="#FFFFFF" style="font-size: 9pt; color: #000000">
      <p align="center"><strong>
        <input type="text" name="judgeper" size="18" class="inputnormal" onkeyup="if(isNaN(this.value)) this.value='2';" onblur="this.className='inputnormal';checktotal();" onfocus="this.className='inputedit';this.select()" value="2">
      </strong></td>
    </tr>
    <tr   height="20">
      <td style="font-size: 9pt; color: #000000" align="center" colspan="4">
        <strong>  考试时间设定</strong></td>
    </tr>
    <tr height="20">
      <td width="128" style="font-size: 9pt; color: #000000" align="center"  >
          考试时间(<font color="#FF0000">小时</font>)</td>
      <td width="855" colspan="3" bgcolor="#FFFFFF" style="font-size: 9pt; color: #000000">
      <p align="center"><strong>
        <input type="text" name="testtime" size="18" class="inputnormal" onkeyup="if(isNaN(this.value)) this.value='2';" onblur="this.className='inputnormal'" onfocus="this.className='inputedit';this.select()" value="2">
      </strong></td>
    </tr>
    <tr height="20">
      <td width="128" style="font-size: 9pt; color: #000000" align="center"  >
          有效期</td>
      <td width="855" colspan="3" bgcolor="#FFFFFF" style="font-size: 9pt; color: #000000">
      <p align="center"><strong>
      <input type="text" name="starttime" size="18" class="inputnormal" onblur="javascript:this.className='inputnormal';vbscript:checkstarttime()" onfocus="this.className='inputedit';this.select()" value="<%=date()%>">
      <input type="text" name="endtime" size="18" class="inputnormal" onblur="this.className='inputnormal'" onfocus="this.className='inputedit';this.select()" value="<%=date()%>">
      </strong></td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td width="100%" colspan="5">
      <p align="right">
        <input type="submit" value="提交" name="B1" class="smallInput"></td>
    </tr>
  </form>
</table>
<script language="vbscript" id="clientEventHandlersVBS">  
function checkstarttime()
if isDate(firstform.starttime.value)=false then
  msgbox "非法的开始日期格式!"
  firstform.starttime.focus
elseif firstform.starttime.value > firstform.endtime.value then
  msgbox "开始日期不能大于结束日期!"
  firstform.starttime.focus
end if 
end function
function checkendtime()
if isDate(firstform.endtime.value)=false then
  msgbox "非法的开始日期格式!"
  firstform.endtime.focus
elseif firstform.starttime.value > firstform.endtime.value then
  msgbox "开始日期不能大于结束日期!"
  firstform.endtime.focus
end if 
end function
</script>

</body>

</html><br><br><br><br><br><br>
 

⌨️ 快捷键说明

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