日期:2014-05-16 浏览次数:20769 次
<%set conn=server.createobject("ADODB.RecordSet")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("nianji.mdb")
%>
<%
set km=Server.CreateObject("ADODB.RecordSet") '矿名,相当于你要的省份名
km.open "select distinct km from dwdzb order by km"
conn,1,1
set dm=Server.CreateObject("ADODB.RecordSet") '队名,相当于你要的城市名
dm.open "select * from dwdzb order by dm"
conn,1,1
%>
<script language="javascript">
dm=new Array();
var count;
count=0;
<%
c=0
if not (dm.eof and dm.bof) then
dm.movefirst
end if
do while not dm.eof
%>
dm[<%=c%>]=new Array("<%=trim(dm("km"))%>","<%=trim(dm("dm"))%>","<%=trim(dm("dwdm"))%>");
<%
c=c+1
dm.movenext
loop
%>
count=<%=c%>;
function checkdm(km)
{
var i,j;
j=1;
if(km=="管理员")
{
document.f1.dm.length=1;
document.f1.dm.options[0]=new Option("","");
}
if(km=="全部")
{
document.f1.dm.length=1;
document.f1.dm.options[0]=new Option("全部","全部");
}
for(i=0;i<count;i++)
{
if(dm[i][0]==km)
{
document.f1.dm.length=j+1;
document.f1.dm.options[j]=new Option(dm[i][1],dm[i][1]);
j=j+1;
}
}
}
</script>
<table align=center border=1 cellpadding="0" cellspacing="0" bordercolordark="#FFFFFF" bordercolorlight="#000000">
<form name="f1" method="post" action="login_check.asp">
<tr height=30>
<td width=80> 矿名:</td>
<td width=120>
<%km.movefirst%>
<select name="km" size="1" onChange="checkdm(document.f1.km.value)"> '重点在这里,onchange事件
<option value="管理员">管理员</option>
<%do while not km.eof%>
<option value=<%=km("km")%>><%=km("km")%></option>
<%km.movenext
loop%>
</select>
</td>
</tr>
<tr height=30>
<td> 队名:</td>
<td>
<select name="dm" size="1">
<option> </option>
</select>
</td>
</tr>
<tr height=30>
<td> 密码:</td>
<td