触摸屏租赁
Touch screen rental
广告机租赁
Advertising rental
机器人租赁
Robot leasing
 当前位置:首页 > > javascript无刷新二级联动

<!--#include file="Conn.asp"-->
<%
dim cid,coid
cid=Request("cid")
coid=Request("coid")
Set rs=CreateObject("adodb.recordset")
rs.open "Select * from FittingsType",conn,1,1    '获取大类数据
strOption1 = " <option value= ''>=请选择分类= </option >"
do while not rs.eof
    if cstr(rs("id")) = cstr(cid) then 
        strOption1 = strOption1 & " <option value='" & rs("id") & "' selected >" & rs("typename") & "</option >"
    else 
        strOption1 = strOption1 & " <option value= '" & rs("id") & "'>" & rs("typename") & "</option >" 
    end if 
    rs.movenext 
loop
rs.close

rs.open "Select * from mode",conn,1,1    '获取小类数据
%>
<script language="javascript">
<!--
//先定义大类和小类数组
var minclass=Array();
<%
js=0
do while not rs.eof%>
minclass[<%=js%>]=new Array("<%=rs("id")%>","<%=rs("mode")%>","<%=rs("typeid")%>");
<%rs.movenext
js=js+1
loop
rs.Close
Set rs=nothing
Conn.Close
Set Conn=nothing
%>

function changesmall()
{
    var indexvalue=document.all("cid").options[document.all("cid").selectedIndex].value;
    var j=0;
    document.all("coid").length = 0;
    document.all("coid").options[0]=new Option("=请选择型号=","0");
    for(i=0;i<minclass.length;i++)
    {
        if(minclass[i][2]==indexvalue)
        {
            document.all("coid").options[document.all("coid").length]=new Option(minclass[i][1],minclass[i][0]);
        }
    }
}
function setvalue(cvalue)
{
    var m,n;
    m=document.all("coid").length;
    for(n=0;n<m;n++)
    {
        if(document.all("coid").options[n].value==cvalue)
        {
            document.all("coid").selectedIndex=n;
            return;
        }
    }
}
-->
</script>
<script language="javascript" defer="defer">
setvalue("<%=coid%>");
</script>
<select onChange="changesmall()" name="cid" > <%=strOption1%> </select > 
<select name="coid">=请选择型号=</select>

来源:展洋科技 www.35544216.com


工作室地址:重庆石桥铺电脑城B座 | 微信:z35544216 | 网址:www.35544216.com