注册 登录
编程论坛 ASP技术论坛

请求高手帮忙,联动下拉框

wcj888 发布于 2009-07-29 12:28, 684 次点击
<%@ Language=VBScript %><!--#include file="data.asp"-->


<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>设备登记</title>
<%
dim sql,rs
set rs=server.createobject("adodb.recordset")
sql="select  * from [abss] where bz='1'"
rs.open sql,conn,1,1
%>

<script language="javascript">
   var onecount;
   onecount=0;
   subcat = new Array();
 <%
   count = 0
   do while not rs.eof
 %>
subcat[<%=count%>]= new Array ("<%=trim(rs("id"))%>","<%=rs("sbbh")%>","<%=rs("xh")%>","<%=rs("sbmc")%>");
 <%
   count =count +1
   rs.movenext
   loop
   rs.close
   set rs=nothing
 %>
 onecount=<%=count%>;
 function changelist(locationid)
       {
       document.form1.abss.length =0;
       var i;
       var locationid=locationid;
       document.form1.abss.options[0] = new Option('====所有设备====','');
       for (i=0;i<onecount;i++)
       {
       if(subcat[i][0]==locationid
       {
       document.form1.abss.options[document.form1.abss.length]= new option(subcat[i][3],subcat[i][1]);
       }
       }
       }
</script>
<style type="text/css">
</style>
</head>
<body>
<p align="center"><b><font size="5"  face="华文新魏" color="#1927ED">设备登记</font></b></p>
<hr height="4">
    <form name="form1" method="post" width="600">
     <p><font size="2"> 单位&nbsp;&nbsp;
<% Response.Write "<select name=id width=100px onChange=changelist(document.form1.id.options[document.form1.id.selectedIndex].value)>"

           set rs=server.createobject("adodb.recordset")
          sql="select  *  from [shop]"
         rs.open sql,conn,1,1
        do while not rs.eof
            Response.Write "<option value="&rs("id")&">"&rs("name")&"</option>"
            rs.movenext
        loop
        set rs=nothing         
            %>    </select>
       
        <font size="2">设备</font>
        <select name="abss">
        <option selected value="">==所有设备==</option></select>
      </p>

    <p align="center">
    <input type="submit" name="Submit3" value="提交" style="background-color:#B8EFF6"></form>
    <input type="submit" value="退出" style="background-color:#1CBFCC" ></p>
<%end if%>      

</body>
</html>





请问怎么改才能联动abss选择项?请求高手帮我改一下
10 回复
#2
wcj8882009-07-29 16:21
高手都到哪里去,快半天了,也没一个人来
#3
yms1232009-07-29 16:49
document.form1.abss.options[document.form1.abss.length]= new option(subcat[i][3],subcat[i][1]);
你这句话已经在修改选项还要问怎么改么?
#4
wcj8882009-07-30 09:44
什么意思呀?能不能说的具体些,不太懂你的意思!
#5
wcj8882009-07-30 09:45
我前面列的不能联动,所以请求高手指点一下
#6
aspic2009-07-30 09:45
请搜索一下 以前有过类似问题 还写过例子
#7
wcj8882009-07-30 11:00
最好帮忙改一下,别的例子也不实用,高手请帮忙!
#8
aspic2009-07-30 11:44
最好动脑动手
#9
wcj8882009-07-30 14:48
会不会呀?这里的论坛也只一般而己,没能力请不要说闲话嘛,有功夫说闲话,没功夫指出错误!我已经想了好几天了,都没解决!
#10
aspic2009-07-30 14:52
OK 既然你这么说 我想这个论坛没人告诉你了 如果你说例子不实用 是你自己的问题 知道举一反三吗 你就想要别人写得跟你的一模一样?你觉得自己写得很好?你的写法很好?
#11
wcj8882009-07-31 09:36
一堆废话,有什么用?
1