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

📄 m_cur_add.asp

📁 本人的课程设计。不足之处请大家指教。因为第一次用ASP有很多不足的地方。
💻 ASP
字号:
<!-- #include file="cookies.asp" -->
<script language="JavaScript">
function check()
{
if(document.form1.name.value == '')
        {
                window.alert('请输入名称');                
				document.form1.name.focus();
				return false;				
        }
if(document.form1.id.value == '')
        {
                window.alert('请输入编号');                
				document.form1.id.focus();
				return false;				
        }
if(document.form1.pro.value == '')
        {
                window.alert('请输入所属专业');                
				document.form1.id.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="80%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td><table width="100%" border="0" align="center" bgcolor="#FFFFFF">
        <form name="form1" method="post" action="m_addsave.asp?edit=add&act=curricula" onsubmit="return check();">
          <tr> 
            <td><font color="#FF0000">请不要输入# * , 等非法字符</font></td>
          </tr>
		  <tr><td>课程编号:       
			  </td>
		  </tr>
		  <tr><td>
		 	  <input name="id" type="text" size="10"> <font size="2">&nbsp; </font>		       
			  </td>
		  </tr>
		  <tr><td>课程名称:       
			  </td>
		  </tr>
		  <tr><td>
		 	  <input name="name" type="text" size="50"> <font size="2">&nbsp; </font>		       
			  </td>
		  </tr>
			<tr><td>
			<p>所属专业:
			   <%set rstype=createobject("adodb.recordset")
				sql="select * from profession order by id"
				rstype.Open sql,conn,1,1%>
				<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 type="submit" name="Submit" value="创建"> </td>
          </tr>
        </form>
      </table>
<hr width="800">
<table width="100%" border="0" align="center">
  <form name="form2" method="post" action="">
 			<tr><td>
			<p>专业类别:
			   <% '动态显示专业
			    set rstype=createobject("adodb.recordset")
				sql="select * from profession order by id"
				rstype.Open sql,conn,1,1%>
				<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>	
			<input name="ok" type="submit" value="确定"></p>
			</td></tr> 
  </form>
  <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")
	  
	 '如果选择了专业,则取出对应专业下的课程
	  if trim(request.form("pro")) = "" then
	  sql="select * from curricula order by id"
	  else
	  sql="select * from curricula where pname='"&trim(request.form("pro"))&"' order by id"
	  end if 
	  
	  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="100%" border="0" cellpadding="4" cellspacing="0" align="center">
	    <tr> 
          <td><strong>课程编号</strong></td>
          <td><strong>课程名称</strong></td>
		  <td><strong>所属专业</strong></td>
		  <td width="100"><strong>加入时间</strong></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 width="15%"><%=trim(rs("id"))%></td>
	  <td width="35%"><%=trim(rs("name"))%></td>
	  <td width="25%"><%=trim(rs("pname"))%></td>
	  <td width="13%"><%=trim(rs("addtime"))%></td>
	  <td width="10%">
	     <input type="button" name="Submit4" value="编辑" onclick="window.open('m_edit.asp?id=<%=trim(rs("id"))%>&act=curricula');return false;">
	  </td>
	  <td width="10%">	  
	     <input type="button" name="Submit3" value="删除" onClick="window.open('m_del.asp?id=<%=trim(rs("id"))%>&act=curricula');return false;"> 
	  </td>


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

</table>
<table border="0" width="100%" align="center" bgcolor="<%=tablebgcolor_2%>">
  <tr> 
    <td> 
            <div align="left"><font color="#000000">共有试卷记录<%=rs.recordcount%>条</font></div>
    </td>
    <td width="8%" align="center"> <font color="#000000"> 
      <% if page="1" then %>
      上页 
      <%else%>
      <a href=addexam.asp?page=<%=page-1%>>上页</a> 
      <% end if %>
      </font></td>
    <td width="8%" 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 + -