classadd.asp

来自「网络考试系统最终备份」· ASP 代码 · 共 206 行

ASP
206
字号
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<link rel="stylesheet" type="text/css" href="css.css">
<!--#include file="conn.inc"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script language="javascript">
function addit(myform)
{

   if ((myform.scollege.value == "-请选择院校-") || (myform.scollege.value == ""))
  {   
          alert("请选择院校!");
		  return false
   }
    	
		
		 if ((myform.sdepartment.value == "-请选择系部-") || (myform.sdepartment.value == ""))
  {   
          alert("请选择系部!");
		  return false
   }
    	


  if ((myform.smayjor.value == "-请选择专业-") || (myform.smayjor.value == ""))
  {   
          alert("请选择专业!");
		  return false
   }
   else
   { 		  
       if ((myform.className.value == "请输入班级名称") || (myform.className.value == ""))
        {
        alert("请输入班级名称!不能为空");
        return false;
        } 
       else
	   {
	     myform.action="classsave.asp";
		   return true;
	  
	   }

	}
}


function csubmit()
{
manclass.sdepartment.value="-请选择系部-";
manclass.smayjor.value="-请选择专业-";
manclass.submit();
}
function ssubmit()
{
manclass.smayjor.value="-请选择专业-";
manclass.submit();
}

</script>
</head>

<body>
  <form method="POST" name="manclass"   action="classadd.asp">
<table border="1" cellpadding="0" cellspacing="1" style="border-collapse: collapse" bordercolor="#C0C0C0" width="41%" id="AutoNumber3" height="20">

  <%
  v_cid = request("scollege")
    v_dep = request("sdepartment")
	  v_may = request("smayjor")
  %>
    <tr>
      <td colspan="2"  nowrap bgcolor="#E1E1E1"><select size="1" name="scollege" onChange="csubmit();">
          <option value="-请选择院校-">-请选择院校-</option>
          <%
		
		  if v_cid = "-请选择院校-" or v_cid="" then
		sql = "select * from college_info"
		else
		sql = "select * from college_info where CollegeID <>"&v_cid
		end if
		
        set rs = server.CreateObject("adodb.recordset")
		rs.open sql,conn,3,2
		do while not rs.eof
		if not rs.eof then
		  
		%>
          <option  value="<%=rs("CollegeID")%>" ><%=rs("CollegeName")%></option>
          <%
		rs.movenext
		end if
		loop
		rs.close
		set rs = nothing
		

		if v_cid <> "-请选择院校-" and v_cid<>"" then
		
		sql = "select * from college_info where CollegeID = "&v_cid
        set rs = server.CreateObject("adodb.recordset")
		rs.open sql,conn,3,2
		%>
        <option value="<%=rs("CollegeID")%>" selected><%=rs("CollegeName")%></option>
        <%
		  rs.close
		set rs = nothing
		end if
		
		
		
		
		%>
        </select>    &nbsp;    <select size="1" name="sdepartment" onchange="ssubmit();">
          <option value="-请选择系部-"  selected>-请选择系部-</option>
          <%
			
		  
			if v_dep = "-请选择系部-" or v_dep="" then
		    sql = "select * from department_info where  College_ID like '"&v_cid&"' "
			else
		    sql = "select * from department_info where  College_ID like '"&v_cid&"'and DepID <> "&v_dep&" "
			end if
		
       	   set rs = server.CreateObject("adodb.recordset")
		   rs.open sql,conn,3,2
		   do while not rs.eof
		   if not rs.eof then
		%>
          <option  value="<%=rs("DepID")%>"><%=rs("DepName")%></option>
          <%
		rs.movenext
		end if
		loop
		rs.close
		set rs = nothing
		
		if v_dep <> "-请选择系部-" and v_dep <> "" then
		   sql = "select * from department_info where  College_ID like '"&v_cid&"'and DepID = "&v_dep&" "
		   set rs = server.CreateObject("adodb.recordset")
		   rs.open sql,conn,3,2
		
		%>
          <option selected value="<%=rs("DepID")%>"><%=rs("DepName")%></option>
          <% end if%>
        
        </select>    &nbsp;    <select size="1" name="smayjor" >
          <option value="-请选择专业-"  selected>-请选择专业-</option>
          <%
		  
			if v_may = "-请选择专业-" or v_may = "-所有专业-" or v_may="" then
		    sql = "select * from mayjor_info where  College_ID like '"&v_cid&"' and Dep_ID like '"&v_dep&"' "
			else
		    sql = "select * from mayjor_info where  College_ID like '"&v_cid&"' and Dep_ID like '"&v_dep&"' and MayjorID<>"&v_may
			end if
		
       	   set rs = server.CreateObject("adodb.recordset")
		   rs.open sql,conn,3,2
		   do while not rs.eof
		   if not rs.eof then
		%>
          <option  value="<%=rs("MayjorID")%>"><%=rs("MayjorName")%></option>
          <%
		rs.movenext
		end if
		loop
		rs.close
		set rs = nothing
		
		if v_may <> "-请选择专业-" and v_may <> "-所有专业-" and v_may<>"" then
		   sql = "select * from mayjor_info where  College_ID like '"&v_cid&"' and Dep_ID like '"&v_dep&"' and MayjorID="&v_may
		   set rs = server.CreateObject("adodb.recordset")
		   rs.open sql,conn,3,2
		
		%>
          <option  selected value="<%=rs("MayjorID")%>"><%=rs("MayjorName")%></option>
          <% end if%>
          <input name="incollege" type="hidden" value="<%=v_cid%>">
        </select></td>
    </tr>
    <tr>
      <td colspan="2"  nowrap bgcolor="#E1E1E1">班级名称:
      <input name="className" type="text" id="className" value="请输入班级名称"></td>
    </tr>
    <tr>
      <td width="39"  nowrap bgcolor="#E1E1E1"><p align="center">班<br>
          级<br>
          描<br>
        述</p>
      </td>
      <td width="410"  nowrap bgcolor="#E1E1E1"><textarea name="textarea" cols="45" rows="5"></textarea></td>
    </tr>
    <tr>
      <td colspan="2"  nowrap bgcolor="#E1E1E1"><div align="right">
        <input type="submit" name="Submit" onClick="addit(this.form);" value="添加班级">
        <input type="reset" name="Submit" value="重填">
      </div></td>
    </tr>
</table>
  </form>
</body>
</html>

⌨️ 快捷键说明

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