日期:2014-05-18  浏览次数:20667 次

JSP大小类用列表框来实现怎么做
<TD> <select   name= "selectm "   id= "select ">
                                                                  <option   value= " "> 大类 </option>
<%
                              rs=p_dbBean.executeQuery( "select   *   from     aa ");
      while   (rs.next())
      {
%>
        <option   value= " <%=rs.getString( "id ")%> "> <%=rs.getString( "aa ")%> </option>

                                                       
<%
      }
%>  
</select>
        </TD>


<td> <select   name= "selectm1 "   id= "select1 ">
            <option   value= " "> 小类 </option>
                <%
                              rs1=p_dbBean.executeQuery( "select   *   from     bb     where   tt= '   "   +   mm   +   "   '   ");
      while   (rs1.next())
      {
%>
        <option   value= " <%=rs1.getString( "TT ")%> "> <%=rs1.getString( "gg ")%> </option>
    <%
}
    %>
</select> </td>

------解决方案--------------------
描述的不清楚~……
------解决方案--------------------
动态二级联动菜单
<form name=Form type=post>
<select name= "dep " onchange= "onChange(this.value) "> //当值改变时就执行函数
<option value= "部门ID "> 部门名 </option> //中间的option是从数据库读出生成的
</select>
<select name= "name ">
<option value= "0 "> 请先选择部门 </option>
</select>
</form>
<script LANGUAGE=JavaScript>
<!--
var name=new Array();
<%
for(int i=0;i <parrStsUserList.size();i++)
{
pobjCp = (Cp)parrStsUserList.get(i);
out.println( "name[ "+i+ "]=new Array( ' "+pobjCp.getCpID()+ " ', ' "+pobjCp.getCpname()+ " ', ' "+pobjCp.getCpuseid()+ " '); ");
}
%>
-->
</script>
getCpID是ID,getCpname是名字(王小二),getCpuseid是他的部门ID
<script LANGUAGE=JavaScript>
<!--
function onChange(dep)
{
ln = Form.name.options.length;
while(ln--) {
Form.name.options[ln] = null;//清空员工姓名的select的值
}
for(i=0;i <name.length;i++)
{
if(name[i][2]==dep)//如果name[i][2]部门ID等于dep时
{
Form.name.add(new Option(name[i][0],name