搜索的问题,请大家务必帮忙,分不够再添

xxl713930 2005-06-19 10:12:36
我需要在一个页面放两个列表框,一个列出产品的品牌,当选择了品牌后,在另一个列表框中列出相应的产品名称,选择了产品后,点击查询,提交到其它页面列出该产品的详细信息,请问该如果实现呢?请大侠们知道啊!
...全文
56 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
xxl713930 2005-06-19
  • 打赏
  • 举报
回复
好累啊,明天还得上班,我明天再按上面老大的指点试一下,不过要是有大侠给我代码就不胜感激了,没有的话我只好自己想破脑袋了,呵呵
linseng129 2005-06-19
  • 打赏
  • 举报
回复
思路:在<option onchange事件里写将选择value的值传到hidden里面
xxl713930 2005-06-19
  • 打赏
  • 举报
回复
现在就是没法取得select0这个列表框的值,所以select1这个列表框无法获得相应的值,当我对select0进行选择时,select1的值并没有改变
xxl713930 2005-06-19
  • 打赏
  • 举报
回复
if request("select")=2 then str="select 产品名称 from 产品表 where 品牌='SNOOPY'"
if request("select")=3 then str="select 产品名称 from 产品表 where 品牌='佳露思'"
if request("select")=4 then str="select 产品名称 from 产品表 where 品牌='TYPE_R'"
其中的request("select")应为request("select0")
xxl713930 2005-06-19
  • 打赏
  • 举报
回复
<form name="form1" method="post" action="../order/productSearch.asp">

<p>请选择品牌
<select name="select0" size="1" >
<option value="1" >所有品牌</option>
<option value="2" selected>snoopy</option>
<option value="3">佳露思</option>
<option value="4">type_r</option>
<option value="5">其它</option>
</select>

</p>

<%
if request("select0")="" then str="select 产品名称 from 产品表"
if request("select0")=1 then str="select 产品名称 from 产品表"
if request("select")=2 then str="select 产品名称 from 产品表 where 品牌='SNOOPY'"
if request("select")=3 then str="select 产品名称 from 产品表 where 品牌='佳露思'"
if request("select")=4 then str="select 产品名称 from 产品表 where 品牌='TYPE_R'"
if request("select0")=5 then str="select 产品名称 from 产品表 where 品牌='其它'"
set rs1=server.createobject("adodb.recordset")
rs1.open str,conn,0,1
%>
<p>请选择产品</p>
<p> <select name="select1" size="1">
<%
if rs1.bof=false then
while not rs1.eof
%>
<option value="<%=rs1.fields("产品名称")%>"><%=rs1.fields("产品名称")%></option>
<%rs1.movenext
wend
end if
rs1.close
%>
</select>
</p>
<p>
<input type="submit" name="Submit" value="查询">
</p>
</form>
cqhunter 2005-06-19
  • 打赏
  • 举报
回复
要把你的代码贴出来,否则别人不晓得怎么办?
dh20156 2005-06-19
  • 打赏
  • 举报
回复
参考:
<script language="javascript">
<% sql1="exec showct_ct"
Set rs1=Server.CreateObject("Adodb.Recordset")
rs1.Open sql1,conn,1,1 %>
var temp_1;
var sz_ct;
sz_ct = new Array();
<% If Not rs1.eof then
temp_2=0
do while not rs1.eof %>
sz_ct[<%=temp_2%>] = new Array("<%=rs1("customerid")%>","<%=rs1("ctno")%>","<%=rs1("ctname")%>","<%=rs1("cttype")%>","<%=rs1("cttel")%>","<%=rs1("ctaddress")%>","<%=rs1("ywy")%>","<%=rs1("pdzk")%>");
<% rs1.MoveNext
temp_2=temp_2+1
Loop
end if
rs1.close
Set rs1=Nothing %>
temp_1 = <%=temp_2%>;
function changect(id){
var id = id;
for(i=0;i<temp_1;i++){
if(sz_ct[i][0]==id){
document.all.ctid.value = sz_ct[i][0];
document.all.ctno.value = sz_ct[i][1];
document.all.ctname.value = sz_ct[i][2];
document.all.cttype.value = sz_ct[i][3];
document.all.cttel.value = sz_ct[i][4];
document.all.ctaddress.value = sz_ct[i][5];
document.all.shdz.value = sz_ct[i][5];
document.all.ywy.value = sz_ct[i][6];
document.all.pdzk.value = sz_ct[i][7];
}
}
}
</script>
<form name="formtop" method="post" action="shd_save.asp" onsubmit="return checkinfo();">
<table width="100%" cellpadding="0" cellspacing="0" class="div_border">
<tr height="60"><td colspan="4" align="center">TITLE</td></tr>
<tr><td colspan="10" height="1"><img src="../images/dot.gif" width="100%" height="1"></td></tr>
<tr height="20">
<td width="16%" class="pybk">客户编号:</td>
<td width="33%" id="khbh" class="pybk">
<input type="text" id="bindtxt" name="ctno" style="font-size:12px;border:none;width:100%" onkeypress="if(event.keyCode==13){inputct(this.value);}" value="<%=ctno%>">
<select name="sctno" style="position:absolute; top:expression((khbh.offsetTop) + 'px'); left:expression((khbh.offsetLeft) + 'px'); width: 100%; height: 18px; clip: expression('rect(2 ' + this.offsetWidth +' 18 ' + (this.offsetWidth - 18) +')');background-color:#ffffff; font-size:12px;" onChange="if(this.value!=0){changect(this.value);}">
<option value="0">请选择客户编号</option>
<% sql = "Select customerid,ctno from customer order by ctno"
Set rs = Server.CreateObject("Adodb.Recordset")
rs.open sql,conn,1,1
If Not rs.eof then
Do While not rs.eof %>
<option value="<%=rs("customerid")%>"><%=rs("ctno")%></option>
<% rs.MoveNext
Loop
end if
rs.close
Set rs = Nothing %>
</select>
</td>
<td width="17%" class="pybk">客户名称:</td>
<td width="34%"><input type="text" name="ctname" style="font-size:12px;border:none;width:100%" value="<%=ctname%>"></td>
</tr>
<tr><td colspan="10" height="1"><img src="../images/dot.gif" width="100%" height="1"></td></tr>
<tr height="20">
<td width="16%" class="pybk">客户类型:</td>
<td width="33%" class="pybk"><input type="text" name="cttype" style="font-size:12px;border:none;width:100%" value="<%=cttype%>"></td>
<td width="17%" class="pybk">结款方式:</td>
<td width="34%"><input type="text" name="paymethod" style="font-size:12px;border:none;width:100%" value="<%=paymethod%>"></td>
</tr>
<tr><td colspan="10" height="1"><img src="../images/dot.gif" width="100%" height="1"></td></tr>
<tr height="20">
<td width="16%" class="pybk">客户电话:</td>
<td width="33%" class="pybk"><input type="text" name="cttel" style="font-size:12px;border:none;width:100%" value="<%=cttel%>"></td>
<td width="17%" class="pybk">客户地址:</td>
<td width="34%"><input type="text" name="ctaddress" style="font-size:12px;border:none;width:100%" value="<%=ctaddress%>"></td>
</tr>
<tr><td colspan="10" height="1"><img src="../images/dot.gif" width="100%" height="1"></td></tr>
<tr height="20">
<td width="16%" class="pybk">送货人:</td>
<td width="33%" class="pybk"><input type="text" name="shr" style="font-size:12px;border:none;width:100%" value="<%=shr%>"></td>
<td width="17%" class="pybk">送货地址:</td>
<td width="34%"><input type="text" name="shdz" style="font-size:12px;border:none;width:100%" value="<%=shdz%>"></td>
</tr>
<tr><td colspan="10" height="1"><img src="../images/dot.gif" width="100%" height="1"></td></tr>
<tr height="20">
<td width="16%" class="pybk">业务员:</td>
<td width="33%" class="pybk"><input type="text" name="ywy" style="font-size:12px;border:none;width:100%" value="<%=ywy%>"></td>
<td width="17%" class="pybk">开单员:</td>
<td width="34%"><input type="text" name="czy" style="font-size:12px;border:none;width:100%" value="<%=czy%>"></td>
</tr>
</table>
</form>
xxl713930 2005-06-19
  • 打赏
  • 举报
回复
主要是前面一步,因为选择了品牌后,仍然在同一个页面,不知怎样获得选择的值,以致后面没法判断执行哪句sql语句,高手们,帮帮忙 吧

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧