asp在下拉框显示对应值
setrst1=server.CreateObject("adodb.recordset")sql="selectdepartment,departmentidfromd...
set rst1=server.CreateObject("adodb.recordset")
sql="select department,departmentid from department "
rst1.open sql,conn,1,1
%>
<select name="sel" id="sel">
<option value=""></option>
<%do until rst1.EOF %>
<option value="<%=rst1("departmentid")%>" <% if rst1("departmentid")=request.QueryString("departmentid") then response.Write"selected"%>><%=rst1("department")%></option>
<%rst1.MoveNext
loop%>
</select>
先获取departmentid的值,request.QueryString("departmentid") 可以得到值。但这个值所对应的department不会在下拉框里显示出来。帮忙改一下 展开
sql="select department,departmentid from department "
rst1.open sql,conn,1,1
%>
<select name="sel" id="sel">
<option value=""></option>
<%do until rst1.EOF %>
<option value="<%=rst1("departmentid")%>" <% if rst1("departmentid")=request.QueryString("departmentid") then response.Write"selected"%>><%=rst1("department")%></option>
<%rst1.MoveNext
loop%>
</select>
先获取departmentid的值,request.QueryString("departmentid") 可以得到值。但这个值所对应的department不会在下拉框里显示出来。帮忙改一下 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询