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

📄 exam_add.asp

📁 本人的课程设计。不足之处请大家指教。因为第一次用ASP有很多不足的地方。
💻 ASP
字号:
<!-- #include file="cookies.asp" -->
<script language="JavaScript">
function check()
{
if(document.form1.ename.value == '')    //课程名为空
        {
                window.alert('请输入课程名称');                
				document.form1.ename.focus();
				return false;				
        }
if(document.form1.eid.value == '')		//试题编号为空
        {
                window.alert('请输入试题编号');                
				document.form1.eid.focus();
				return false;				
        }
if(document.form1.text.value == '')		//试卷名为空
        {
                window.alert('请输入试卷名称');                
				document.form1.text.focus();
				return false;				
        }
if(document.form1.pro.value == '')		//未选择所属专业
        {
                window.alert('请输入所属专业');                
				document.form1.pro.focus();
				return false;				
        }
}
</script>
<!-- #include file="conn/conn.asp" -->
<html>
<head>
<title>出题</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#EEEEEE" text="#000000">
<!-- #include file="button_t.asp" -->
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td><table width="760" border="0" align="center" bgcolor="#FFFFFF">
        <form name="form1" method="post" action="exam_save.asp" onsubmit="return check();">
          <tr> 
            <td>&nbsp;</td>
          </tr>
		  <tr><td><p>专  业:
		  		<%  '动态显示专业
				set rstype=createobject("adodb.recordset")
				sql="select * from profession order by id"
				rstype.Open sql,conn,1,3%>
				<select name="pro">
				<option value="">请选择</option>
				<%do while not rstype.EOF%>
				<option value="<%=rstype("name")%>"><%=rstype("name")%></option>
				<%
				rstype.MoveNext
				loop
				set rstype=nothing
				%>
				</select>
		       </p>
			  </td>
		  </tr>
          <tr> 
            <td>课程名称: 
              <input name="ename" type="text" size="50"> <font size="2">&nbsp; </font>
			</td>
          </tr>
		  <tr> 
            <td>试题编号: 
              <input name="eid" type="text" size="4"> <font size="2">&nbsp;(如1 ,必须为阿拉伯数字) </font>
			</td>
          </tr>
		  <tr> 
            <td>试卷名称: 
              <input name="text" type="text" size="50"> <font size="2">&nbsp; </font>
			</td>
          </tr>
          <tr> 
            <td> <input type="submit" name="Submit" value="创建"> </td>
          </tr>
        </form>
      </table>
<hr width="900">
<table width="750" border="0" align="center">
        <tr> 
    <td bgcolor="#CCCCCC"><font color="#0000FF">【试卷管理】</font></td>
  </tr>
  <%
  	  '分页显示记录
		if request("page")="" then
		page="1"
		else 
		page=request("page")
		end if
		set rs=server.createobject("adodb.recordset")
		sql="select * from exam order by ename"		'取多有试卷
		rs.open sql,conn,1,1
		if not rs.eof then
		x=x+1
		rs.pagesize=30
		rs.Absolutepage=clng(page)
		if cstr(page)=cstr(rs.PageCount) and (rs.RecordCount mod rs.PageSize <> 0) then                      
		   recend=rs.RecordCount mod  rs.PageSize                      
		else                       
		   recend=rs.PageSize                      
		end if 
		if request("page")<>"" then
		end if

%>
  <tr>
    <td>
      <table width="900" border="0" cellpadding="4" cellspacing="0" align="center">
	    <tr> 
          <td><strong>试卷名称</strong></td>
          <td><strong>课程名称</strong></td>
		  <td width="40"><strong>编号</strong></td>
          <td width="200"><strong>所属专业</strong></td>
		  <td width="100"><strong>加入时间</strong></td>
          <td width="55">&nbsp;</td>
          <td width="45">&nbsp;</td>
		  <td width="45">&nbsp;</td>
        </tr>
<%
	for i=1 to recend
		 if i mod 2=1 then
		 color="#f8f8f8"
		 else
		 color="#E4e4e4"
		 end if
 %>
      <tr bgcolor="<%=color%>" valign="middle">

	   <td>
		   <% '判断是否发布
		    if trim(rs("fabu"))="1" then%>
			<a href="exam_view.asp?eid=<%=trim(rs("eid"))%>&ename=<%=trim(rs("ename"))%>&text=<%=trim(rs("text"))%>" target="_blank">
		   <%end if%>		   
		   <%=trim(rs("text"))%>
		   <%if trim(rs("fabu"))="1" then%>
			(已发布)</a>           
		   <%end if%>	
	   </td>	   
	  <td>
			<%=trim(rs("ename"))%>
	  </td>
	  <td width="40"><%=trim(rs("eid"))%></td>
	  <td width="200"><%=trim(rs("pname"))%></td>
	  <td width="100"><%=trim(rs("addtime"))%></td>
	  <td width="55"> 
		<%if trim(rs("fabu"))="1" then%>
		<input type="button" name="Submit" value="不发布" onclick="location.href='exam_fb.asp?eid=<%=trim(rs("eid"))%>&ename=<%=trim(rs("ename"))%>&fabu=2';"> 
		<%else%>
		<input type="button" name="Submit2" value="发布" onclick="location.href='exam_fb.asp?eid=<%=trim(rs("eid"))%>&ename=<%=trim(rs("ename"))%>&fabu=1';"> 
		<%end if%>
	  </td>

	  <%if trim(rs("fabu"))="1" then%>
	  <td width="45">&nbsp;</td>
	  <td width="45">&nbsp;</td>
	  <%else%>
	  <td width="45">
	     <input type="button" name="Submit4" value="编辑" onclick="window.open('exam_edit.asp?eid=<%=trim(rs("eid"))%>&ename=<%=trim(rs("ename"))%>&text=<%=trim(rs("text"))%>','intr','menubar=no,toolbar=no,location=no,directories=no,status=yes,scrollbars=1,resizable=0,width=500,height=400,top=80,left=100');return false;">
	  </td>
	  <td width="45">	  
	     <input type="button" name="Submit3" value="删除" onClick="window.open('exam_del.asp?eid=<%=trim(rs("eid"))%>&ename=<%=trim(rs("ename"))%>&text=<%=trim(rs("text"))%>','intr','menubar=no,toolbar=no,location=no,directories=no,status=yes,scrollbars=1,resizable=0,width=300,height=150,top=80,left=100');return false;"> 
	  </td>
	  <%end if%>

	</tr>
  <%
  rs.movenext
  next
  %> 
       </table>
    </td>
  </tr>

</table>
<table border="0" width="760" align="center" bgcolor="<%=tablebgcolor_2%>">
  <tr> 
    <td> 
            <div align="left"><font color="#000000">共有试卷记录<%=rs.recordcount%>条</font></div>
    </td>
    <td width="40" align="center"> <font color="#000000"> 
      <% if page="1" then %>
      上页 
      <%else%>
      <a href=addexam.asp?page=<%=page-1%>>上页</a> 
      <% end if %>
      </font></td>
    <td width="40" align="center"> <font color="#000000"> 
      <% if page=cstr(rs.pagecount) then %>
      下页 
      <%else%>
      <a href=addexam.asp?page=<%=page+1%>>下页</a> 
      <% end if %>
      </font>
	  <%
	  end if 
	  rs.close
	  set rs=nothing
	  %></td>
  </tr>
</table></td>
  </tr>
</table>
</body>
</html>
<%
conn.close
set conn=nothing
%>

⌨️ 快捷键说明

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