你是不知道怎么操作数据库吧?
假设A有两个字段:id  name
<%
    //建立到数据库的连接
%>   
    <select name="a" size="1" style="width:200px">
<option value="0"></option>
<%

sqlStr = "select * from A";
rs = st.executeQuery(sqlStr);
while ( rs.next() ) {
out.println("<option value='" + rs.getInt("id") + "'>" + rs.getString("name") + "</option>");

}
rs.close();
%>
</select>

解决方案 »

  1.   


    <script language="javascript">
    var fatherList=new Array(2);
    var aListValue = new Array(2); 
    fatherList[0]="a";aListValue[0] = new Array("1","2");
    fatherList[1]="d";aListValue[1] = new Array("456");var nCurIndex = null;function setupList()
    {
      if (nCurIndex != document.frmtest.name1.selectedIndex)
      {var sValue = document.frmtest.name1.selectedIndex;var i;
    //remove existing list
    for (i=document.frmtest.name2.options.length-1; i >=0 ; i--)
    document.frmtest.name2.options.remove(i);for (i=0; i < aListValue[sValue].length;i++)
    {
    var opt = new Option(aListValue[sValue][i],aListValue[sValue][i]);
    document.frmtest.name2.options.add(opt);
    }  }}
    </script><body onload="setupList()">
    <form name="frmtest" action="" method="post">
      List1: 
      <select name="name1" onchange="setupList()">
        <script language="javascript">
    for(i=0;i<fatherList.length;i++){
    document.write("<option value=\"" + fatherList[i] + "\">" + fatherList[i] + "</option>");
    }
    </script>
      </select>
      <br>
      List2: 
      <select name="name2">
      </select>
      <br>
    </form>
    </body>