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

📄 que_add.asp

📁 本人的课程设计。不足之处请大家指教。因为第一次用ASP有很多不足的地方。
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!-- #include file="cookies.asp" -->

<!-- #include file="conn/conn.asp" -->

<% '没有试卷,不能加入题目
set rs=createobject("adodb.recordset")
sql="select * from exam order by ename"
rs.Open sql,conn,1,1
if rs.eof then
%>
<script>
window.alert("请先创建试卷!")
history.go(-1);
</script>
<%
end if
rs.close
set rs=nothing
%>


<script language="JavaScript">
function check()
{
if(document.form1.ename.value == '')
        {
                window.alert('请选择所属课题');                
				document.form1.ename.focus();
				return false;				
        }
if(document.form1.qid.value == '')
        {
                window.alert('请输入题目编号');                
				document.form1.qid.focus();
				return false;				
        }
if(document.form1.qname.value == '')
        {
                window.alert('请输入题目名称');                
				document.form1.qname.focus();
				return false;			
        }
if(document.form1.key1.value == '' )
        {
                window.alert('请输入可选项A');                
				document.form1.key1.focus();
				return false;			
        }
if(document.form1.key2.value == '')
        {
                window.alert('请输入可选项B');                
				document.form1.key2.focus();
				return false;
        }
if(!(document.form1.rightkey[0].checked||document.form1.rightkey[1].checked||document.form1.rightkey[2].checked||document.form1.rightkey[3].checked||document.form1.rightkey[4].checked||document.form1.rightkey[5].checked||document.form1.rightkey[6].checked))
        {
                window.alert('请选择标准答案');                
				return false;
        }
}
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网上考试系统 - 创建题目</title>
</head>

<body bgcolor="#EEEEEE">
<!-- #include file="button_t.asp" -->

<table width="760" border="0" align="center" bgcolor="#FFFFFF">
  <%'计算当前题号
  set rs=server.createobject("adodb.recordset")
  sql="select * from question order by qid"
  rs.open sql,conn,1,1
  rs.movelast
  x=rs("qid")+1		'最大题号加1
  rs.close
  set rs=nothing
  %>

  <tr> 
    <td> 
        <table width="80%" border="0" align="left">
          <tr>
          <td>&nbsp;</td>
        </tr></table></td>
  </tr>
  <tr> 
    <td>
      <table width="100%" border="0">
        <form name="form1" method="post" onsubmit="return check();" action="que_save.asp">
		  <tr>
		     <td> <div align="right">所属课程:</div></td>
		     <td> <%	'动态显示课程名下拉框
			 	set rstype=createobject("adodb.recordset")
				sql="select * from curricula order by id"
				rstype.Open sql,conn,1,1%>
				<select name="ename">
				<option value="">请选择</option>
				<%do while not rstype.EOF%>
				<option value="<%=rstype("name")%>"><%=rstype("name")%></option>
				<%
				rstype.MoveNext
				loop
				rstype.close
				set rstype=nothing
				%>
				</select>
			  </td>
		  </tr>
          <tr> 
            <td> <div align="right">题  目:</div></td>
            <td> <textarea name="qname" cols="70" id="qname"></textarea></td>
          </tr>
          <tr> 
            <td> <div align="right">题  型:</div></td>
            <td> <input type="radio" name="qtype" value="1" checked>
             	 单选题 
             	 <input type="radio" name="qtype" value="2">
              	 多选题
             	 <input type="radio" name="qtype" value="3">
              	 判断题
			</td>
          </tr>
          <tr> 
            <td valign="top"> <div align="right">可 选 项:</div></td>
            <td> <p>A: 
                <input name="key1" type="text" id="key1" size="55">
                <input name="rightkey" type="checkbox" value="A">
                <font size="2">(请选择标准答案)</font><br>
                B: 
                <input name="key2" type="text" id="key2" size="55">
                <input name="rightkey" type="checkbox" value="B">
                <br>
                C: 
                <input name="key3" type="text" id="key3" size="55">
                <input name="rightkey" type="checkbox" value="C">
                <br>
                D: 
                <input name="key4" type="text" id="key4" size="55">
                <input name="rightkey" type="checkbox" value="D">
                <br>
                E: 
                <input name="key5" type="text" id="key43" size="55">
                <input name="rightkey" type="checkbox" id="rightkey" value="E">
                <br>
                F: 
                <input name="key6" type="text" id="key5" size="55">
                <input name="rightkey" type="checkbox" id="rightkey3" value="F">
                <br>
            
              </p></td>
          </tr>
          <tr> 
            <td valign="top"> <div align="right"></div></td>
            <td></td>
          </tr>
          <tr> 
            <td>&nbsp;</td>
            <td> <input name="rkon" type="submit" id="rkon" value="提交"> <input type="reset" name="Submit2" value="取 消"> 
              <input type="hidden" name="qid" value="<%=x%>"></td>
          </tr>
        </form>
      </table></td>
  </tr>
</table>
</body>
</html>
<%
conn.close
set conn=nothing
%>

⌨️ 快捷键说明

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