ASP+JS三级联动下拉菜单[调用数据库数据](2)


    {
        if (subval2[i][0] == locationid)
        {document.form1.s2.options[document.form1.s2.length] = new Option(subval2[i][2],subval2[i][1]);}
    }
}
function changeselect2(locationid)
{
    document.form1.s3.length = 0;
    document.form1.s3.options[0] = new Option('==请选择专题==','');
    for (i=0; i<subval3.length; i++)
    {
        if (subval3[i][0] == locationid)
        {document.form1.s3.options[document.form1.s3.length] = new Option(subval3[i][2],subval3[i][1]);}
    }
}
//-->
</script>
<form name="form1" method="post" action="test1.asp">
三级联动:
<%
Dim count1,rsClass1,sqlClass1
set rsClass1=server.createobject("adodb.recordset")
sqlClass1="select * from a" 
rsClass1.open sqlClass1,conn,1,1
%>
<select name="s1" onChange="changeselect1(this.value)">
<option>==请选择频道==</option>
<%
count1 = 0
do while not rsClass1.eof
response.write"<option value="&rsClass1("ID")&">"&rsClass1("Name")&"</option>"
count1 = count1 + 1
rsClass1.movenext
loop
rsClass1.close
%>
</select>
<select name="s2"  onChange="changeselect2(this.value)"> 
<option>==请选择类别==</option>
</select>
<select name="s3"> 
<option>==请选择专题==</option>
</select>
<input type="submit" name="Submit" value="提交"></form>
<!-- 三级联动菜单 结束 -->