用javascript 就行  用个判断,, if() 当选择第几个项目时候,就跳转到另一个表

解决方案 »

  1.   

    还有一种是初始化两个客户端数组,如Varr1和Varr2,其中Varr1是一维的数组,用于填入部门数据,Varr2是SQL中据此部门检索出的该部门的名单(相信读者在排序中能够一次性的得到这样的两个数组),然后将Varr1装入到第一个下拉列表中,Varr2的第一行的数据装入到第二个下拉列表中,在第一个下拉列表的改变事件中,通过获取的序号,来清除第二个列表中的数据,并重新装填第二个列表中的数据.
      

  2.   

    <%@ page language="java" import="java.sql.*" %>
    <jsp:useBean id="workM" scope="page" class="Show.DBconn" /> <form name="form1" method="post" action="">
     <%!
    public String getStr1(String str)
    {
    try
    {
    String temp_p=str;
    byte[] temp_t=temp_p.getBytes("gb2312");
    String temp=new String(temp_t,"ISO8859-1");
    return temp;
    }
    catch(Exception e)
             {
     e.printStackTrace();

    return "无";
    }
    }
    %><%     String sql2,sql1;
        sql2="select * from School ";
        sql1="select * from Class ";
        //out.print(sql2);
    ResultSet school=workM.executeQuery(sql2);   //取所有的学校结果集
    ResultSet classrs=workM.executeQuery(sql1); //取所有学校下面的所有班级结果集
    String SID=""; 
    %>
    <select name="ShlName"  onchange="showC2()" style="width:150">
    <option value="0" selected>请选学校名</option>
    <%
    while (school.next())
    {
    SID=school.getString("SchoolID");
    %><option value="<%=SID%>"><%=getStr1(school.getString("SchoolName"))%></option>
    <%
    }
    school.close();%>
    </select>
    <font color="#FF0000">*</font> 
    <SCRIPT LANGUAGE="JavaScript">
    c2Name=new Array();  //班级名
    c2Id=new Array();    //班级IDfunction showC2(){
         selected=document.form1.ShlName.selectedIndex;
     if(selected==0){
            document.form1.ClassName2.length=0;
            document.form1.ClassName2.length++;
    document.form1.ClassName2.options[document.form1.ClassName2.length-1].value="0";
    document.form1.ClassName2.options[document.form1.ClassName2.length-1].text="请选择班级";
            //showClassName2All();
           return ;
     }     index=document.form1.ShlName.options[selected].value;
         document.form1.ClassName2.length=0;
     for(i=0;i<c2Name.length;i++){
    if(c2Id[i].indexOf(index)!=-1){
                 document.form1.ClassName2.length++;
     document.form1.ClassName2.options[document.form1.ClassName2.length-1].value=c2Id[i];
     document.form1.ClassName2.options[document.form1.ClassName2.length-1].text=c2Name[i];
    }
     }
    }
    <%
    int count=0;
    while (classrs.next()){
    String t_id=classrs.getString("ClassID");
    String t_name=classrs.getString("ClassName");
    t_name=getStr1(t_name);
    out.println("c2Name["+count+"]=\""+t_name+"\";");
    out.println("c2Id["+count+"]=\""+t_id+"\";");
    count++;
    }
    classrs.close();%>
    </SCRIPT>
    <SELECT NAME="ClassName2" style="width:150">
    <option value="0" selected >请选择班级</option>
    </SELECT>
    </form>
      

  3.   

    用javascript挺容易的呀
    还有一种是初始化两个客户端数组,如Varr1和Varr2,其中Varr1是一维的数组,用于填入部门数据,Varr2是SQL中据此部门检索出的该部门的名单(相信读者在排序中能够一次性的得到这样的两个数组),然后将Varr1装入到第一个下拉列表中,Varr2的第一行的数据装入到第二个下拉列表中,在第一个下拉列表的改变事件中,通过获取的序号,来清除第二个列表中的数据,并重新装填第二个列表中的数据.这个方法也很好,我喜欢