Vbscript创建下拉列表
从数据库中读取出来的数据,通过一个下拉列表点击后,改变另一个下拉列表中的内容,我一直都用JS写的,现在如果使用Vbscript来做,遇到点问题。如何创建列表我忘了,查也没有查到。贴出我写的前一段代码。
<%
sql="select * from custom where c_flag=0"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,1
if not rs.eof then
i=0
%>
<script language=vbscript>
dim a(<%=rs.recordcount-1%>,2)
dim total
total=<%=rs.recordcount%>
<% while not rs.eof
%>
a(<%=i%>,0)="<%=rs(0)%>"
a(<%=i%>,1)="<%=rs(1)%>"
a(<%=i%>,2)="<%=rs(2)%>"
<%
i=i+1
rs.movenext
wend
%>
sub change1(x)
document.form1.c_name.length=0
for i=0 to total
if a(i,2)=x then
求这一块的代码
end if
next
end sub
</script>
<%
end if
%>
页面执行如下:
<script language=vbscript>
dim a(2,2)
dim total
total=3
a(0,0)="1"
a(0,1)="林木集团"
a(0,2)="1"
a(1,0)="2"
a(1,1)="美特斯·邦威"
a(1,2)="2"
a(2,0)="3"
a(2,1)="真维斯"
a(2,2)="1"
sub change1(x)
document.form1.c_name.length=0
for i=0 to total
if a(i,2)=x then
end if
next
end sub
</script>