首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

[点滴积累]jdbc与js结合的级联上拉列表

2012-11-17 
[点滴积累]jdbc与js结合的级联下拉列表代码片段td valigntop p alignright车牌号码:/p/tdt

[点滴积累]jdbc与js结合的级联下拉列表
代码片段

<td valign="top" ><p align="right">车牌号码:</p></td>            <td >          <select size="1" name="CLID"  onchange="javaScript:changelocation(this.value);" style="width:200">            <option value="">==请选择==</option><%    SQL = "Select CLID,CPHM,CLMC,SJMC from CL_JBXX where 1=1;";    ResultSet rs_1 = queryData.getResultSet(SQL );int iCLID_select = 0;String sjmc2 = "";    while (rs_1.next()){   iCLID_select = rs_1.getInt("CLID");     sCPHM = rs_1.getString("CPHM");     sCLMC = rs_1.getString("CLMC");    // sSJMC = rs_1.getString("SJMC");%>      <option  <% if (iCLID_select == iCLID)  {%> selected <% } %> value="<%=iCLID_select%>"><%=sCLMC%>(<%=sCPHM%>)</option><% } %>              </select></td>            <td >              <p align="right">司机名称:</td>            <td ><input name="SJMC"   value="<%=sSJMC%>" type="text" maxlength="100" size="20"></td>          </tr><%     sql =  "Select  CLID,CPHM,CLMC,SJMC  from  CL_JBXX  where  1=1 ;"     ResultSet rsSelect = queryData.getResultSet(sql );%>      <script language = "JavaScript">        var onecount;        onecount=0;        subcat = new Array();<%int iCount = 0;String sSJMC2="";         while (rsSelect.next()){     iCLID = rsSelect.getInt("CLID");     sCPHM = rsSelect.getString("CPHM");     sCLMC = rsSelect.getString("CLMC");     sSJMC2 = rsSelect.getString("SJMC");%>            subcat[<%=iCount%>] = new Array("<%=sSJMC2%>","<%=iCLID%>");<%             iCount = iCount + 1;         }%>  onecount=<%=iCount%>;</script>


 function changelocation(locationid)     {         var locationid=locationid;         var ii;         for (ii=0;ii < onecount; ii++)         {             if  ((subcat[ii][1] == locationid) || (locationid==0) )             {                 document.form.SJMC.value = subcat[ii][0];             }         }    }

热点排行