欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

下拉框连动的小例子(数据库版)

程序员文章站 2022-05-09 20:54:46
asp文件:<%@ language=vbscript %><%option explicit%>l...</div> <div class="content"> asp文件:<br><%@ language=vbscript %><br><%option explicit%><br><html><br><head><br><title>list</title><br><meta http-equiv="content-type" content="text/html; charset=gb2312"><br><%<br>dim conn<br>dim rs<br>dim sql<br>dim count<br>dim rs1<br>dim sql1<br><br><br>set conn = server.createobject ("adodb.connection")<br>conn.open "test","sa",""<br><br><br>sql = "select * from district order by locationid asc"<br>set rs = conn.execute(sql)<br>%><br><script language = "<a href="https://www.2cto.com/kf/ware/java/" target="_blank" class="keylink" rel="nofollow">java</a>script"><br>var onecount;<br>onecount=0;<br>subcat = new array();<br>        <%<br>        count = 0<br>        do while not rs.eof <br>        %><br>subcat[<%=count%>] = new array("<%= trim(rs("districtname"))%>","<%= trim(rs("locationid"))%>","<%= trim(rs("districtid"))%>");<br>        <%<br>        count = count + 1<br>        rs.movenext<br>        loop<br>        rs.close<br>        set rs=nothing<br>        %><br>onecount=<%=count%>;<br><br>function changelocation(locationid)<br>    {<br>    document.myform.smalllocation.length = 0; <br><br>    var locationid=locationid;<br>    var i;<br>    document.myform.smalllocation.options[0] = new option(====所有地区====,);<br>    for (i=0;i < onecount; i++)<br>        {<br>            if (subcat[i][1] == locationid)<br>            { <br>                document.myform.smalllocation.options[document.myform.smalllocation.length] = new option(subcat[i][0], subcat[i][2]);<br>            }        <br>        }<br>        <br>    }    <br></script><br></head><br><body><br><form name="myform" method="post"><br>    <select name="biglocation" onchange="changelocation(document.myform.biglocation.options[document.myform.biglocation.selectedindex].value)"><br>        <%<br>        <br>        sql1 = "select * from location order by locationname asc"<br>        set rs1 = conn.execute (sql1)<br>        do while not rs1.eof </div> <div class="info-pre-next"> <p> 上一篇: <a href="/article/924367.html"> 编程实现求最小的K个数 </a> </p> <p> 下一篇: <a href="/article/924369.html"> Android开发教程—安卓四大组件解析 </a> </p> </div> <div class="wz_tuijian"> <p> 推荐阅读 </p> <ul> <li> <a href="/article/1799524.html" target="_blank" title="三级下拉框连动的数据库版"> <h2> 三级下拉框连动的数据库版 </h2> </a> </li> <li> <a href="/article/1797196.html" target="_blank" title="下拉框连动的小例子(.htm版)"> <h2> 下拉框连动的小例子(.htm版) </h2> </a> </li> <li> <a href="/article/924368.html" target="_blank" title="下拉框连动的小例子(数据库版)"> <h2> 下拉框连动的小例子(数据库版) </h2> </a> </li> <li> <a href="/article/599886.html" target="_blank" title="下拉框连动的小例子(.htm版)"> <h2> 下拉框连动的小例子(.htm版) </h2> </a> </li> <li> <a href="/article/421229.html" target="_blank" title="三级下拉框连动的数据库版"> <h2> 三级下拉框连动的数据库版 </h2> </a> </li> </ul> </div> </article> </div> </main> <footer><div class="box"><div class="ft_nav"><div class="ft_about"><p>关于网站</p><ul><li><a href="/sitemap.xml" target="_blank" title="网站地图">网站地图</a></li><li><a href="/list/2/" title="最新程序员文章站">最新程序员文章站</a></li></ul></div><div class="ft_contact"><ul><li>本站所有数据收集于网络如有侵犯到您的权益,请联系我们进行下架处理。</li><li class="email_show"></li></ul></div></div><div class="copyright"><div class="cr_left"><p> 备案号:<a href="https://beian.miit.gov.cn/#/Integrated/index" target="_blank">粤ICP备20058927号</a></p><p>© Copyright © 2020-2022 www.superweb999.com 程序员文章站. </p></div></div></div></footer> </body> </html>