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

📄 untitled.jsp

📁 多功能学生宿舍管理系统 分布式体系结构
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" errorPage="" %>
<%@ page language="java" import="java.util.*,java.lang.*,java.sql.*" pageEncoding="gb2312"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
 <head>
 <%@page import="myweb.DBContent.DBContent"%>
 <jsp:useBean id="db" class="myweb.DBContent.DBContent"/>
 <script language="javascript">
  var DeparmentCount; //三级联动菜单代码
  DeparmentCount = 0;
  var DivisionCount;
  DivisionCount = 0;
  var SpecialityCount;
  SpecialityCount = 0
  Department = new Array();
  Division = new Array();
  Speciality = new Array();
<%
  ResultSet rs = db.select("select * from division");
  int i=0;
 while(rs.next()){%>
   Division[<%=i%>] = new Array("<%=rs.getString("divisionname")%>","<%=rs.getString("departmentid")%>","<%=rs.getString("divisionid")%>");
<% 
i++;
 }
%>
  DivisionCount = <%=i%>;
<%
  System.out.println("debug....1");
  rs =db.select("select * from speciality");
  i=0;
 while(rs.next()){	%>
 
   Speciality[<%=i%>] = new Array("<%=rs.getString("specialityname")%>","<%=rs.getString("divisionid")%>","<%=rs.getString("specialityid")%>");
<%   
i++;
}
%>
  SpecialityCount = <%=i%>;
   
function changeDepartment(DepartmentId){
 document.form1.Switch.value="false";
 document.form1.division.length = 0;
     var DepartmentId = DepartmentId;
     var i;
     for (i=0;i < DivisionCount; i++){
         if (Division[i][1] == DepartmentId){ 
       document.form1.division.options[document.form1.division.length] = new Option(Division[i][0], Division[i][2]);
             }        
        }
       changeDivision(document.form1.division.value);
}

function changeDivision(DivisionId){
 document.form1.Switch.value="false";
    document.form1.speciality.length = 0;
 var DivisionId = DivisionId;
    var i;
    for (i=0;i < SpecialityCount; i++){
  if (Speciality[i][1] == DivisionId){ 
          document.form1.speciality.options[document.form1.speciality.length] = new Option(Speciality[i][0], Speciality[i][2]);
        }        
 }
 if(document.form1.speciality.length!=0){
  document.form1.speciality.style.visibility = 'visible';
 }
 else{  
  document.form1.speciality.style.visibility = 'hidden';
 }
}

function  initialSelect(){
changeDepartment(document.form1.department.options[document.form1.department.selectedIndex].value);
}
</script>
<%@page import="myweb.bean.DateChooserJButton" %>
<jsp:useBean id="da" class="myweb.bean.DateChooserJButton"></jsp:useBean>
  </head>
  <body onLoad="initialSelect();">
  <table width="700" border="1">
    <tr>
      <td><form name="form1">
        <select name="department" size="1" id="department" style="width:20%" onChange="changeDepartment(document.form1.department.options[document.form1.department.selectedIndex].value)">
          <%
  rs = db.select("select * from department");
  i=0;
 while(rs.next()){%>
          <option value="<%=rs.getString("departmentid")%>" selected><%=rs.getString("departmentname")%></option>
          <%
i++;
}
 //da.action()
%>
        </select>
        <select name="division" size="1" id="division" onChange="changeDivision(document.form1.division.options[document.form1.division.selectedIndex].value)">
        </select>
        <input type="hidden" name="Switch" value="false">
        <select name="speciality"  size="1" id="speciality">
        </select>
      </form></td>
    </tr>
  </table>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  </body>
</html>

⌨️ 快捷键说明

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