精华区 [关闭][返回]

当前位置:网易精华区>>讨论区精华>>编程开发>>● ASP>>ASP范例>>利用rds在客户端实现双选单联动的例子(原

主题:利用rds在客户端实现双选单联动的例子(原
发信人: ydwh()
整理人: i_am_trueman(2003-10-22 16:46:40), 站内信件
利用rds在客户端实现双选单联动的例子

注意:需要设置相应的系统dsn,并且网页所在的web目录要有“执行”权限。
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
<script language="vbscript">
<!--
sub t1()
zm.length=adc1.Recordset.recordcount
adc1.Recordset.movefirst
'把adc1所有的内容添加到zm选单
for i=0 to adc1.Recordset.recordcount-1
zm.options(i).text=adc1.Recordset.fields("mingzi").value
zm.options(i).value=adc1.Recordset.fields("id").value
adc1.Recordset.movenext
next
if kg.length=0 then
zm.selectedindex=0
call t2()
end if
end sub
sub t2()
'根据zm选单选中的内容作为查询条件,来进行adc2的查询
adc2.sql="select * from kaiguan where changzhanid=" & zm.value & " or
der by dianyadengjiid,mingzi"
adc2.Refresh
end sub
sub t3()
'根据adc2的变化,把adc2的内容添加到kg选单(在此实现双选单联动)
kg.length=adc2.Recordset.recordcount
adc2.Recordset.movefirst
for i=0 to adc2.Recordset.recordcount-1
if not isnull(adc2.Recordset.fields("mingzi").value) then
kg.options(i).text=adc2.Recordset.fields("mingzi").value
kg.options(i).value=adc2.Recordset.fields("id").value
adc2.Recordset.movenext
else
kg.length=kg.length-1
end if
next
end sub
-->
</script>

</head>

<body>
<OBJECT CLASSID="CLSID:BD96C556-65A3-11D0-983A-00C04FC29E33" ID="adc1"
HEIGHT=1 WIDTH=1 ondatasetcomplete="t1()">
<PARAM NAME="Server" VALUE="http://服务器的名字">        
<PARAM NAME="Connect" VALUE="DSN=服务器上对应的dsn名字">
<PARAM NAME="sql" VALUE="select id,mingzi from changzhan">
</OBJECT>
<OBJECT CLASSID="CLSID:BD96C556-65A3-11D0-983A-00C04FC29E33" ID="adc2"
HEIGHT=1 WIDTH=1 ondatasetcomplete="t3()">        
<PARAM NAME="Server" VALUE="http://ct">        
<PARAM NAME="Connect" VALUE="DSN=test">
</OBJECT>
<select name="zm" onclick="t2()"></select>
<select name="kg"></select>                                   
</body>                                   
                                   
</html>                                   

--
※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 61.128.169.208]

[关闭][返回]