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

下拉菜单取值,该如何解决

2012-03-13 
下拉菜单取值汽车品牌:selectname brand option 请选择 /option/select车类选择:%dimrs_s

下拉菜单取值
汽车品牌:
                                <select   name= "brand ">
                                    <option> ==请选择== </option>
                                </select>
车类选择:
<%
dim   rs_s
set   rs_s=server.createobject( "adodb.recordset ")
rs_s.open   "select   *   From   Abrand   where   kind= ' "&a& " ' ",conn,1,1
%>
<select   name= "sort "   class= "wenbenkuang "   id= "sort "   onChange= "(document.myform.sort.value=this.options[this.selectedIndex].value) ">
    <option   selected> </option>
    <%
while   not   rs_s.eof
%>
    <option   value= " <%=rs_s( "shop ")%> "> <%=rs_s( "shop ")%> </option>
    <%
rs_s.movenext
wend
rs_s.close
set   rs_s=nothing
%>
</select>

我想取brand菜单中的值用在这条语句 "select   *   From   Abrand   where   kind= ' "&a& " ' "中做查询条件。请各位高手指点

[解决办法]
选汽车品牌的时候要提交一下
要不rs_s.open "select * From Abrand where kind= ' "&a& " ' ",conn,1,1
的时候会取不到a的值

或者使用xmlhttp
[解决办法]
<select name= "brand " onchange= "location.href= '本页?a= '+ this.value ">
<option> ==请选择== </option>
</select>

dim a
a = Request.Querystring( "a ")

然后 执行你的代码就可以了
select * From Abrand where kind= ' "&a& " ' "
[解决办法]
把汽车品牌放到form 中提交,车类选择接收
dim a
a=request.form( "brand ")

热点排行