亚洲AV日韩AⅤ综合手机在线观看,激情婷婷久久综合色,欧美色五月婷婷久久,久久国产精品99久久人人澡

  • <abbr id="uk6uq"><abbr id="uk6uq"></abbr></abbr>
  • <tbody id="uk6uq"></tbody>
  • 用JSP和JavaScript打造級連菜單

    時間:2024-10-22 02:35:56 SUN認(rèn)證 我要投稿
    • 相關(guān)推薦

    用JSP和JavaScript打造級連菜單

      JavaScript引擎,為瀏覽器的一部分,廣泛用于客戶端的腳本語言,最早是在HTML(標(biāo)準(zhǔn)通用標(biāo)記語言下的一個應(yīng)用)網(wǎng)頁上使用,用來給HTML網(wǎng)頁增加動態(tài)功能。下面小編準(zhǔn)備了關(guān)于用JSP和JavaScript打造級連菜單的文章,提供給大家參考!

     <%@ page import="java.util.Date,yava.fileapp.*,java.sql.*;"
      contentType="text/html;charset=GB2312" pageEncoding="GB2312"
      %>
      <style>
      .f9{ font-size:9pt; }
      .bgc{ background-color:#AECAF9; color: #0033FF }
      .buttons{font-family:Arial; font-size:13px;
      font-weight:bold; background-color:#6796E4;
      color:white; border-top: solid 2px #AACAFB;
      border-bottom: solid 1px #4E7DC1;
      border-left: solid 1px #AECAF9;
      border-right: solid 1px #5679BD;
      padding:1px;
      margin:0px;}
      </style>
      <SCRIPT LANGUAGE="javascript">
      <!--
      function rv()
      {
      var val="";
      for(i=0;i<combo_box.list2.length;i++){
      val+=","+combo_box.list2[i].value;
      }
      if(val.charAt(0)==","){
      val=val.substr(1,val.length);
      }
      opener.form1.frecname.value=val;
      self.close();
      }
      //-->
      </SCRIPT>
      <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
      <jsp:useBean id="user" scope="session" class="yava.fileapp.UserBean" />
      <%
      CDataSource ds=new CDataSource(); //數(shù)據(jù)聯(lián)結(jié)Bean實例
      java.sql.Connection conn=ds.getConnection();
      java.sql.Statement stmt=null;
      java.sql.ResultSet rs=null;
      CDataCheck dc=new CDataCheck();
      %>
      <%
      String sqlu="SELECT t1.fno, t1.fname, t2.fname AS fdept
      FROM tuser t1 LEFT OUTER JOIN TDept t2
      ON t1.fdept = t2.fno order by t2.fname";
      stmt=conn.createStatement();
      rs=stmt.executeQuery(sqlu);
      %>
      <script language="Javascript">
      arr = new Array();
      <% int temp=0;
      while(rs.next())
      {
      %>
      arr[<%=temp%>]=new Array("<%=rs.getString("fname")%>","<%=rs.getString("fdept")%>");
      <%
      temp = temp + 1;
      }
      %>
      temp=<%=temp%>;
      function ChangeLocation(id){
      document.combo_box.city.length=0; //初始化第2級菜單的長度,下標(biāo)從0開始
      var i = 0;
      document.combo_box.city.options[0]=new Option("-------","");
      for(i=0;i<temp;i++){
      if(arr[i][1]==id){//如果相等,證明在第2級里面有輸入第1級組織的子集,arr[總數(shù)目][部門]
      document.combo_box.city.options[document.combo_box.city.length] = new Option(arr[i][0], arr[i][0]);
      }
      }
      }
      </script>
      <form name="combo_box">
      <table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
      <tr height="24">
      <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部門選擇</font></td>
      <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名選擇</font></td>
      <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
      <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最終人</font></td>
      </tr>
      <tr>
      <td>
      <select multiple id=prov name="prov"
      onchange="ChangeLocation(combo_box.prov.options[combo_box.prov.selectedIndex].text);"
      style="width:150;height:200" class="bgc">
      <option value="0">請選擇部門 ---></option>
      <%
      String sqld="SELECT * FROM tdept";
      stmt=conn.createStatement();
      rs=stmt.executeQuery(sqld);
      while(rs.next())
      {
      %>
      <option name="<%=rs.getString("fno")%>"><%=rs.getString("fname")%></option>
      <%
      }
      %>
      </select>
      </td>
      <td>
      <select multiple id=city style="width:150;height:200" class="bgc">
      </select>
      </td>
      <td nowrap align="center" class="bgc">
      <input type="button" onClick="move(this.form.list2,this.form.city)" value="<<" class="buttons">
      <input type="button" onClick="move(this.form.city,this.form.list2)" value=">>" class="buttons">
      </td>
      <td>
      <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
      </select>
      </td>
      </tr>
      <tr class="bgc">
      <td colspan="4" align="center">
      <input type="button" name="button1" class="buttons" value="選好了!" onclick="rv();"></td>
      </tr>
      </table>
      </form>
      <script language="JavaScript">
      //人名移動
      function move(fbox, tbox) {
      var arrFbox = new Array();
      var arrTbox = new Array();
      var arrLookup = new Array();
      var i;
      for (i = 0; i < tbox.options.length; i++) {
      arrLookup[tbox.options[i].text] = tbox.options[i].value;
      arrTbox[i] = tbox.options[i].text;
      }
      var fLength = 0;
      var tLength = arrTbox.length;
      for(i = 0; i < fbox.options.length; i++) {
      arrLookup[fbox.options[i].text] = fbox.options[i].value;
      if (fbox.options[i].selected && fbox.options[i].value != "") {
      arrTbox[tLength] = fbox.options[i].text;
      tLength++;
      }
      else {
      arrFbox[fLength] = fbox.options[i].text;
      fLength++;
      }
      }
      arrFbox.sort();
      arrTbox.sort();
      fbox.length = 0;
      tbox.length = 0;
      var c;
      for(c = 0; c < arrFbox.length; c++) {
      var no = new Option();
      no.value = arrLookup[arrFbox[c]];
      no.text = arrFbox[c];
      fbox[c] = no;
      }
      for(c = 0; c < arrTbox.length; c++) {
      var no = new Option();
      no.value = arrLookup[arrTbox[c]];
      no.text = arrTbox[c];
      tbox[c] = no;
      }
      }
      </script>
      </body>

    【用JSP和JavaScript打造級連菜單】相關(guān)文章:

    JavaScript和JSP的區(qū)別10-06

    html.jsp和srevlet的關(guān)系09-27

    ,javascript break和continue區(qū)別11-03

    JavaScript-JavaScript數(shù)據(jù)結(jié)構(gòu)和算法之圖和圖算法,10-25

    javascript學(xué)習(xí)筆記--數(shù)組和對象10-16

    使用JavaScript庫的缺點和優(yōu)點10-05

    用javascript打開word文檔的方法06-26

    JavaScript中null和undefined的異同06-14

    Javascript函數(shù)的定義和用法分析08-15

    理解和熟知概念JavaScript的作用域和塊級作用域06-27