原创著作,产权保护 政府、投票、评选、公安、学校、问卷、视频会议专注发展中小企事业 系统报价 | 支付帐号 | 授权查证
    计算机著作版权登记号:2014SR032463 手机:+86-1373066-4304 | QQ:1213920482 欢迎选择智睿软件系统 欢迎选择智睿软件系统
智睿软件系统
asp 二级联动下拉菜单 开发源码
来源:智睿 浏览:27964 次 发布时间:2019-04-18 16:46:19
<!--#include file="Include/conig.asp"-->
<%
sql = "select * from zhi_rui_s_meshi where id=3"
  Set rs = Server.CreateObject("ADODB.RecordSet")
  rs.Open sql,conn,1,1
  classid=rs("classid")
  Topid=rs("Topid")
  rs.close
  set rs=nothing
  Response.Write(classid&"_"&Topid)
%>
<script language="javascript" type="text/javascript">
var onecount;
subcat = new Array();
        <%
Set rs=Conn.Execute("Select * From [zhi_rui_s_io_Class] where topid<>0")
        count = 0
        do while not rs.eof 
        %>
subcat[<%=count%>] = new Array("<%=trim(rs("id"))%>","<%= trim(rs("TopID"))%>","<%= trim(rs("ClassName"))%>");
        <%
        count = count + 1
        rs.movenext
        loop
rs.close:set rs=nothing
        %>
onecount=<%=count%>;
function changelocation(locationid)
    {
    document.form.Topid.length = 1; 
    var locationid=locationid;
    var i;
    for (i=0;i < onecount; i++)
        {
            if (subcat[i][1] == locationid)
            { 
                document.form.Topid.options[document.form.Topid.length] = new Option(subcat[i][2], subcat[i][0]);
            }        
        }
    } 
</script>
<form method="post" action="ru_query.asp" name="form" id="form">
 <select class='common-input' name="ClassId" onChange="changelocation(this.value)">
<option value="">请选择大类</option>   
<% sql2 = "select * from zhi_rui_s_io_Class where topid=0"
Set rs2 = Server.CreateObject("ADODB.RecordSet")
rs2.Open sql2,conn,1,1
while not rs2.eof
%>
<option value='<%=rs2("id")%>' <% if cint(classid)=cint(rs2("id")) then response.write "selected" %>><%=rs2("ClassName")%></option>
<%
rs2.movenext
wend  
rs2.close
set rs2=nothing  
%>
</select>
<select class='common-input' name="Topid">
<option value="">请选择小类</option>   
    <% sql2 = "select * from zhi_rui_s_io_Class where topid="&cint(classid)&" order by id asc"
Set rs2 = Server.CreateObject("ADODB.RecordSet")
rs2.Open sql2,conn,1,1
while not rs2.eof
%>
<option value='<%=rs2("id")%>' <% if cint(Topid)=cint(rs2("id")) then response.write "selected" %>> <%=rs2("ClassName")%></option>
<%
rs2.movenext
wend  
rs2.close
set rs2=nothing  
%>
</select>
</form>
【刷新页面】【加入收藏】【打印此文】 【关闭窗口】
上一篇:智睿网络投票评选管理系统 V 10.7.0 年度网络投票系统,行业投票评选管理系统 下一篇:智睿录取查询报名系统 V 9.7.0 学校录取系统,学校报名系统