日期:2014-05-16 浏览次数:20929 次
<select>
<%
Set conn=Server.CreateObject("ADODB.Connection")
DBPath1=server.mappath("../db/db.mdb")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath1
set rs=conn.execute("select a from b")
do while not rs.eof
%>
<option><%=rs("a")%></option>
<%
rs.movenext
loop
%>
</select>
<select>
<%
rs.movefirst
do while not rs.eof
%>
<option><%=rs("a")%></option>
<%
rs.movenext
loop
%>
</select>
<%
Dim list
Set conn=Server.CreateObject("ADODB.Connection")
DBPath1=server.mappath("../db/db.mdb")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath1
set rs=conn.execute("select a from b")
do while not rs.eof
list=list&",'"&rs("a")&"'"
rs.movenext
Loop
Rs.Close:Set Rs=Nothing
%>
<script type="text/javascript">
var txt=[<%=list%>];//下拉菜单文本
var num=6;//生成几级下拉菜单(从0算起,但不可超出数组下标)
var i_all=num>txt.length-1?txt.length-1:num;//判断是否超出数组下标
var str="";
for(var i=0;i<=i_all;i++){
if(i<i_all){
str+='<select name="sel'+i+'" onchange="option('+i+')" id="sel'+i+'">';
}else{
str+='<select name="sel'+i+'" id="sel'+i+'">';
}
if(i==0){