1个回答
展开全部
<%
Set conn=Server.CreateObject("adodb.connection")
conn.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ="&Server.MapPath("mofei.mdb")
Set Rs=Server.CreateObject("adodb.recordset")
Rs.Open "Select * from depart",conn,1,1
Set subject=Server.CreateObject("adodb.recordset")
subject.Open "Select * from subject",conn,1,1
%>
<script language = "JavaScript">
var sall=new Array();
<%
i=0
do while not subject.bof and not subject.eof
%>
sall[<%=i%>]=new Array("<%=subject("subjectName")%>","<%=subject("departID")%>","<%=subject("subjectID")%>");
<%
i=i+1
subject.movenext
loop
%>
function changeselect(selvalue)
{
document.getElementById("homes001").length=0;
var selvalue=selvalue;
var i;
for(i=0;i<sall.length;i++)
{
if(sall[i][1]==selvalue)
{
document.getElementById("homes001").options.add(new Option(sall[i][0],sall[i][0]))
}
}
}
</script>
<select name="home001" id="classid" onChange="changeselect(document.getElementById('classid').options[document.getElementById('classid').selectedIndex].id)" size="1">
<option>乡镇</option>
<%
do while not rs.bof and not rs.eof
response.write "<option id='"&rs("departid")&"' value='"&rs("departname")&"'>"&rs("departname")&"</option>"
rs.movenext
loop
rs.close
%>
</select>
<select name="homes001" id="Nclaaid">
<option>村名</option>
</select>
Set conn=Server.CreateObject("adodb.connection")
conn.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ="&Server.MapPath("mofei.mdb")
Set Rs=Server.CreateObject("adodb.recordset")
Rs.Open "Select * from depart",conn,1,1
Set subject=Server.CreateObject("adodb.recordset")
subject.Open "Select * from subject",conn,1,1
%>
<script language = "JavaScript">
var sall=new Array();
<%
i=0
do while not subject.bof and not subject.eof
%>
sall[<%=i%>]=new Array("<%=subject("subjectName")%>","<%=subject("departID")%>","<%=subject("subjectID")%>");
<%
i=i+1
subject.movenext
loop
%>
function changeselect(selvalue)
{
document.getElementById("homes001").length=0;
var selvalue=selvalue;
var i;
for(i=0;i<sall.length;i++)
{
if(sall[i][1]==selvalue)
{
document.getElementById("homes001").options.add(new Option(sall[i][0],sall[i][0]))
}
}
}
</script>
<select name="home001" id="classid" onChange="changeselect(document.getElementById('classid').options[document.getElementById('classid').selectedIndex].id)" size="1">
<option>乡镇</option>
<%
do while not rs.bof and not rs.eof
response.write "<option id='"&rs("departid")&"' value='"&rs("departname")&"'>"&rs("departname")&"</option>"
rs.movenext
loop
rs.close
%>
</select>
<select name="homes001" id="Nclaaid">
<option>村名</option>
</select>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询