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

📄 admin_class.asp

📁 eayanQuery思燕大学成绩查询系统 版本 V1.6
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<%option explicit%>
 <!--#include file="../Conn.asp"-->
<!--#include file="../include/md5.asp"-->
<!--#include file="../include/ReplaceHtml.asp"-->
<!--#include file="../include/PublicFunction.asp"-->
<!--#include file="../include/Session.asp"-->
<%
'强制浏览器重新访问服务器下载页面
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
'***************************
Dim Action
Action=request.QueryString("Action")
Select Case  Action
 Case "addTeacher"
  Call addTeacher()
 Case "showlist"
  Call TeacherList(0)'0代表是显示默认的教师列表,1代表是显示搜索结果的教师列表
 Case "Dlel_teacher" 
  Call Dlel_teacher()
 Case "EditTeacher" 
  Call Edit_Teacher()
 Case "InputTeacher" 
   Call ShowSearchForm() 
 Case "ShowSearchResult" 
   Call TeacherList(1) '1代表是显示搜索结果的教师列表
 Case Else
  Call Main(0)
End Select

Sub Main(Add_Or_Edit)
    Dim Form_State 'Add_Or_Edit
	'说明,0代表添加数据,1代表编辑现有数据
	If Add_Or_Edit=0 then Form_State=0
	If Add_Or_Edit=1 then 
	   Form_State=1
	     Dim Edit_Teacher_sql,Edit_Teacher_rs
         'Call OpenConn()
         Edit_Teacher_sql="select * from [class] where class_id='"&request.QueryString("teacher_id")&"'"
         Set Edit_Teacher_rs=server.CreateObject("adodb.recordset")
         Edit_Teacher_rs.open Edit_Teacher_sql,Initialize_Conn,1,3
 	End if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Admin_Teacher.asp管理 </title>
<link href="images/my_style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style>
<script language="javascript">	
function CheckMyForm() 
{
  if(theForm.teacher_name.value == '') {
    alert('请输入班级的名称!');
     theForm.teacher_name.focus();
    return false;
  }
    if (theForm.own_class_num.value!='' && (isNaN(theForm.own_class_num.value) || theForm.own_class_num.value<0))
     {
	 alert("班级的人数应填有效数字!");
	 theForm.own_class_num.value="";
	 theForm.own_class_num.focus();
	 return false; 
   }
    if (theForm.department_id.value == '')
     {
	 alert("请选择班级所在的院系!");
 	 theForm.department_id.focus();
	 return false; 
   }   
    if (theForm.teacher_id.value == '')
     {
	 alert("请选择班级的辅导员!");
 	 theForm.teacher_id.focus();
	 return false; 
   }   
 }
//-->
</script>

<script type="text/javascript">
<!--
function createAjax() {			//该函数将返回XMLHTTP对象实例
	var _xmlhttp;
	try {	
		_xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");	//IE的创建方式
	}
	catch (e) {
		try {
			_xmlhttp=new XMLHttpRequest();	//FF等浏览器的创建方式
		}
		catch (e) {
			_xmlhttp=false;		//如果创建失败,将返回false
		}
	}
	return _xmlhttp;	//返回xmlhttp对象实例
}

function getweblist(divID) {		//该函数用来获取分页数据
	var xmlhttp=createAjax();	//创建变量xmlhttp,并将createAjax()函数创建的对象实例赋于它
	if (xmlhttp) {		//如果xmlhttp对象创建成功,则执行条件语句中的程序
		var content=document.getElementById('teacher_of_class');
		var department_id=document.getElementById('department_id');
		var id=department_id.value;
              //var content=document.getElementById('content');		//获取页面中id为content的对象
		xmlhttp.open('get','ajax_server.asp?id='+id+'&'+'&n='+Math.random(),true);	//打开与服务器的连接,其中get为连接方式,server.asp为要连接的页面,有两个参数,其中第一个参数page为需要返回数据的页数,第二个参数n为一个随机数,这样每次发送的URL都会不一样,相当于都向服务器发出一个新的请求,避免浏览器缓存数据。
		//alert(id);
		xmlhttp.onreadystatechange=function() {		//为xmlhttp对象的readyState属性指定事件,改属性值改变时,则会执行其中的程序
			if (xmlhttp.readyState==4 && xmlhttp.status==200) {	//如果xmlhttp.readyState==4并且xmlhttp.status==200时,执行条件中的程序,其中readyState有五个值,4为请求完成,是客户端向服务器提交的数据成功到达,status有N多值-_-!!,其中200为OK,是指服务器向客户端完成发送数据。
				content.innerHTML=unescape(xmlhttp.responseText);	//将服务器返回的数据解码并写入指定的ID中。
			}
			else {
				content.innerHTML='<span style="color:red"><img src=images/ajax.gif>读取中...</span>';	//如果服务器没有完成传送,则向用户提示正在传输。
			}
		}
		xmlhttp.send(null);	//向服务器发送请求,因为是get请求,会直接附在URL后面,所以这里括号中的数据为null,IE中也可以不写,但FF就必须加上null,否则会发送失败。
	}
}
//-->
</script>
</head>
<body background="images/admin_MainBg.gif">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="22%" height="44">&nbsp;</td>
    <td width="28%">&nbsp;</td>
    <td width="28%">&nbsp;</td>
    <td width="22%">&nbsp;</td>
  </tr>
  <tr>
    <td height="28">&nbsp;</td>

    <td align="center" colspan="2"><%call showTeacherMenu()%></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td height="62">&nbsp;</td>
    <td align="center" colspan="2" rowspan="2">
   <form name="theForm" id="demo" onSubmit="return CheckMyForm()" method="post" action="Admin_class.asp?action=addTeacher"> 
       <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="31%" height="35"><div align="right">班级名称:</div></td>
        <td align="center" width="34%"><input value="<% if Form_State=1 then response.Write(Edit_Teacher_rs("class_name"))%>" type="text" name="teacher_name" onkeydown="if(event.keyCode==13)event.keyCode=9"/></td>
        <td width="35%"><div align="left"><font color="red">*</font>&nbsp;必填项目</div></td>
      </tr>
       <tr>
        <td height="26"><div align="right">所属院系:</div></td>
        <td align="center"><div align="center">
  		  <%
		 if Form_State=1 then 
		   response.Write("<select onchange=""getweblist(this);"" name=""department_id"">")
 		   response.Write("<option value="""&Edit_Teacher_rs("department_id")&""">")
		                  Dim Teacher_orig_Depart_id,skip_id
						       'skip_id代表要跳过的院系编号,防止下列列表中有相同的选项  
						      'Teacher_orig_Depart_id没有修改前,辅导员先前所在院系的id编号
						  Teacher_orig_Depart_id=Edit_Teacher_rs("department_id")
						  skip_id=Edit_Teacher_rs("department_id")
		                  call Show_teacher_department(Teacher_orig_Depart_id,1)'根据编号返回辅导员所在院系的文字描述
		                  response.Write("</option>") '这里的参数为1,代表是不打印出<td></td>
		   call chooseDepart(skip_id)'显示所有院系的列表,此时为编辑模式,需要显示辅导员先前保存的所在院系
		   response.Write("</select>")
		  else
		   response.Write("<select onchange=""getweblist(this);"" name=""department_id"">")
           response.Write("<option value="""">请选择班级所在院系</option>") 
		   'Dim no_skim
		   call chooseDepart(0)'此时没有需要跳过的id
		   response.Write("</select>")
		 end if
		  %>
        
          <!--input value="< \ if Form_State=1 then response.Write(Edit_department_rs(4)) \>" type="text" name="class_num" onkeyup="value=value.replace(/[^\d]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" onkeydown="if(event.keyCode==13)event.keyCode=9"/--></div></td>
        <td><div align="left">
          <div align="left"><font color="red">*</font> 必填 </div></td>
      </tr>
      <tr>
        <td height="37"><div align="right">所属辅导员:</div></td>
        <td align="center"><div id="teacher_of_class">
		<select name="teacher_id"><option value="">选择教师</option>
		<% If Form_State=1 then
		     dim d_id : d_id=request("department_id")
		     call TeacherListSub(d_id)
		  End if
		   %></select></div></td>
        <td><div align="left"><font color="red">*</font> 必填 </div></td>
      </tr>
      <tr>
        <td height="31"><div align="right">班级人数:</div></td>
        <td align="center"><input value="<% if Form_State=1 then response.Write(Edit_Teacher_rs("class_stu_num"))%>" type="text" name="own_class_num" onkeyup="value=value.replace(/[^\d]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" onkeydown="if(event.keyCode==13)event.keyCode=9"/></td>
        <td><div align="left"><font color="red">*</font> 选填,只允许使用数字,否则会出错</div></td>
      </tr>
      <tr>
        <td height="31"><div align="right">
	 <% if Form_State=1 then
	     response.Write("<input type=""submit"" name=""Submit"" value=""完成编辑"" /></div></td>")
		 response.Write("<input type=""hidden"" name=""Edit_model"" value=""1"">")
		 response.Write("<input type=hidden name=class_id value="""&Edit_teacher_rs(0)&""">")
		  else
		 response.Write("<input type=""submit"" name=""Submit"" value=""确定添加""/></div></td>")
		 end if
	 %>	 
        <td align="center"><input type="reset" name="Submit2" value="重新填写" /></td>
        <td align="center">&nbsp;</td>
      </tr>
    </table>
	</form> 	  
	</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td height="129">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td height="153">&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
</html>
<%end sub
sub TeacherList(Is_SearchMode)
		Response.Write "<html>"
		Response.Write "<head>"
		Response.Write "<meta http-equiv=""Content-Type"" content=""text/html; chaRSet=gb2312"">"
		Response.Write "<title>班级管理</title>"
		Response.Write "<meta HTTP-EQUIV=""Content-Type"" Content=""text-html; charset=gb2312"">" 
		Response.Write "<link href=""images/my_Style.CSS"" rel=""stylesheet"" type=""text/css"">"
 		Response.Write "</head>"
 	    Response.Write "<body background=""images/admin_MainBg.gif"" scroll=no topmargin=""0"" leftmargin=""0"">"
		Response.Write "<br>"
	    Response.Write "<br>"
	    Response.Write "<br>"
  '作用 显示院系的列表
    Call showTeacherMenu()   '显示页面顶部的菜单
    Dim TeacherList_rs,TeacherList_sql,page,epage
	Set TeacherList_rs=server.CreateObject("adodb.recordset")
        IF Is_SearchMode=1 then '此时是显示搜索结果的列表***************************
     		Dim SearchKey:SearchKey=HtmlEncode(request("teacher_name"))
            TeacherList_sql="select * from [class] where [class_name] like '%"&SearchKey&"%' order by [class_name] asc"
		 else  
 	       TeacherList_sql="select * from [class] order by class_id desc"
		 End if  
 	TeacherList_rs.open TeacherList_sql,Initialize_Conn,1,1
'*****************分页代码**********************************
TeacherList_rs.pagesize=15
  page=HtmlEncode(request("page"))
  if page <> "" then
     if isnumeric(page)=false then 
       response.write "<script>alert('非法参数!');history.go(-1);</script>" 
	    'response.Write page
       response.end
     end if
     epage=cint(HtmlEncode(request("page")))
     if epage<1 then epage=1
     if epage>TeacherList_rs.pagecount then epage=TeacherList_rs.pagecount
  else
     epage=1
  end if
       'DepartList_rs.absolutepage=epage
  IF Is_SearchMode=1 then '若果是搜索结果列表,则提示相关搜索信息
     Response.Write("<p align=center>您搜索的关键字是:<font color=red>"&SearchKey&"</font>,下面是搜索结果;</p>")
  End if	 
response.write ("<table border=0 cellpadding=0 cellspacing=1 bgcolor=#8ab105 width=80% align=center>")
response.write ("<tr bgcolor=#FFFFFF align=center>")
response.write ("<td>班级编号</td> ")

⌨️ 快捷键说明

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