关于多个下拉菜单之间的关系

现在,有两个下拉菜单,两者之间存在着相互依存的关系;点击第一个菜单,相应地第二个菜单就显示在前者前提条件下所有数据;主要是实时效应!
据个例子:

1   
2response.buffer=true   
3Response.Expires=0   
4Set rs= Server.CreateObject ("ADODB.RecordSet")   
5sql = "select * from customer "   
6rs.open sql, conn,3,3   
 1<select name="c_name" onselect="selectState()">
 2<option> ```
 3   
 4do while not rs.eof   
 5response.write""&amp;amp;rs("s_name")&amp;amp;"&lt;br/&gt;"   
 6
 7```</option>
 8<option> ```
 9 rs.movenext   
10loop   
11
12```</option>
13</select>

//第一下拉菜单
---------------------------

1<script language="javascript">   
2function selectstate()   
3{   
4如何填写?   
5}   
6</script>
1   
2Set rm= Server.CreateObject ("ADODB.RecordSet")   
3sql = "select s_name from customer "   
4rm.open sql, conn,3,3   
1   
2Set rec= Server.CreateObject ("ADODB.RecordSet")   
3sqlstr = "select s_styleno from sample where s_customer='"&rm("s_name")&"'"   
4rec.open sqlstr, conn,3,3   
1<select name="s_no">
2<option>   

do while not rec.eof
response.write""&amp;rec("s_styleno")&amp;"<br/>"

1</option>
2<option>   

rec.movenext
loop

1</option>
2</select>

//第二下拉菜单
请尽快给我答复;多多益善!
---------------------------------------------------------------

给你例子

1   
2kindname=request("kindname")   
 1<html>
 2<head>
 3<title>welcome to CBSources.com!</title> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
 4<script language="vbscript">   
 5sub pop()   
 6kindname=search.kindname.value   
 7window.location="search1.asp?kindname="&kindname&" "   
 8end sub   
 9</script>
10</head>
11<body bgcolor="#FFFFFF" text="#000000" topmargin="5">
12<br/><form action="index.asp" method="post" name="search">
13<table align="CENTER" border="0" cellpadding="2" cellspacing="3" class="bgColor1" width="533">
14<tr>
15<td width="519"> <select name="kindname" onchange="pop()" size="1">
16<option value="安全、防护"></option>
17<option "selected"="" ```="" if="" kindname="安全、防护" response.write="" then="" value="安全、防护"&gt;安全、防护&lt;/option&gt;
18&lt;option "selected"="" ```="" if="" kindname="包装、印刷" response.write="" then="" value="包装、印刷">包装、印刷</option>
19<option "selected"="" ```="" if="" kindname="办公文教、光仪" response.write="" then="" value="办公文教、光仪"&gt;办公文教、光仪&lt;/option&gt;
20&lt;option "selected"="" ```="" if="" kindname="家居用品" response.write="" then="" value="家居用品">家居用品</option>
21<option "selected"="" ```="" if="" kindname="电子电工" response.write="" then="" value="电子电工"&gt;电子电工&lt;/option&gt;
22&lt;option "selected"="" ```="" if="" kindname="家用电器" response.write="" then="" value="家用电器">家用电器</option>
23<option "selected"="" ```="" if="" kindname="服饰" response.write="" then="" value="服饰"&gt;服饰&lt;/option&gt;
24&lt;option "selected"="" ```="" if="" kindname="纺织、皮革" response.write="" then="" value="纺织、皮革">纺织、皮革</option>
25<option "selected"="" ```="" if="" kindname="机械、工业制品" response.write="" then="" value="机械、工业制品"&gt;机械、工业制品&lt;/option&gt;
26&lt;option "selected"="" ```="" if="" kindname="化工、环保、能源" response.write="" then="" value="化工、环保、能源">化工、环保、能源</option>
27<option "selected"="" ```="" if="" kindname="农业、农副产品" response.write="" then="" value="农业、农副产品"&gt;农业、农副产品&lt;/option&gt;
28&lt;option "selected"="" ```="" if="" kindname="建材、房地产" response.write="" then="" value="建材、房地产">建材、房地产</option>
29<option "selected"="" ```="" if="" kindname="交通、运输" response.write="" then="" value="交通、运输"&gt;交通、运输&lt;/option&gt;
30&lt;option "selected"="" ```="" if="" kindname="汽摩及配件" response.write="" then="" value="汽摩及配件">汽摩及配件</option>
31<option "selected"="" ```="" if="" kindname="礼品、工艺品及玩具" response.write="" then="" value="礼品、工艺品及玩具"&gt;礼品、工艺品及玩具&lt;/option&gt;
32&lt;option "selected"="" ```="" if="" kindname="食品、饮料" response.write="" then="" value="食品、饮料">食品、饮料</option>
33<option "selected"="" ```="" if="" kindname="通讯产品" response.write="" then="" value="通讯产品"&gt;通讯产品&lt;/option&gt;
34&lt;option "selected"="" ```="" if="" kindname="冶金、矿产" response.write="" then="" value="冶金、矿产">冶金、矿产</option>
35<option ```="" if="" kindname="库存积压" response.write"selected"="" then="" valve="库存积压"&gt;库存积压&lt;/option&gt;
36&lt;/select&gt; &lt;/td&gt;
37&lt;td width="346"&gt;&lt;span class="smallest"&gt;   

if kindname="" then

1&lt;select name="partkind" size="1"&gt;
2&lt;option value=""&gt;&lt;/option&gt;
3&lt;option&gt;&amp;lt;\-----------------&amp;gt;&lt;/option&gt;
4&lt;option value=""&gt;&lt;/option&gt;
5&lt;option value=""&gt;&lt;/option&gt;
6&lt;option value=""&gt;&lt;/option&gt;
7&lt;/select&gt;
8&lt;/span&gt;&lt;span class="smallest"&gt;   

else

1&lt;select name="partkind" size="1"&gt;   

set rs=strconn.execute("select * from kind where kindname='"&kindname&"' ")
kindid=rs("id")
rs.close
set rs=nothing
set sqlrs=strconn.execute("select * from kind where kindid="&kindid&" ")
do while not sqlrs.eof

1&lt;option ```"="" kindname")="" value="```
2=sqlrs("&gt;```
3=sqlrs("kindname")
4```&lt;/option&gt;   

sqlrs.movenext
if sqlrs.eof then exit do
loop
sqlrs.close
set sqlrs=nothing
end if

1&lt;/select&gt;
2&lt;/span&gt;&lt;/td&gt;
3&lt;td width="194"&gt;.&lt;/td&gt;
4&lt;/tr&gt;
5&lt;/table&gt;
6&lt;/form&gt;&lt;br/&gt;
7&lt;/body&gt;
8&lt;/html&gt;
Published At
Categories with Web编程
comments powered by Disqus