急,二级连动怎样让所选择的经过连动查询后还处于被选状态。分不够可再加。
<!-----------------html中的内容--------------------------------------->
<form name="myform_c" method="post" action="admin_quyu.asp">
<input type="hidden" name="typeqy" value="quyu">
<tr align="center">
<td height="21" align="left">
<select name="biglocation_c" onChange="changelocation_top(document.myform_c.biglocation_c.options[document.myform_c.biglocation_c.selectedIndex].value)" size="1">
<option value="">省份</option>
<%
sql1 = "select * from location order by locationname asc"
set rs1 = conn.Execute (sql1)
do while not rs1.eof
%>
<option value="<%=trim(rs1("locationid"))%>" <%if rs1("locationid")=cint(biglocation_c) then%>selected<%end if%>><%=trim(rs1("locationname"))%></option>
<%
rs1.movenext
loop
rs1.close
set rs1 = nothing
%>
</select>
<select name="wgq_type_c">
<option value="">地区</option>
</select>
<input type="submit" name="Submit_quyu" value="查询"> </td>
</tr>
</form>
<!------------------连动的代码这里该怎样改写?-------------------------------->
<%
sql = "select * from district order by districtid asc"
set rs = conn.execute(sql)
%>
<script language = "javascript">
var onecount,count;
onecount=0;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("districtname"))%>","<%= trim(rs("locationid"))%>","<%= trim(rs("districtid"))%>");
<%
count = count + 1
rs.movenext
loop
rs.close
set rs=nothing
%>
onecount=<%=count%>;
function changelocation_top(locationid)
{
document.myform_c.wgq_type_c.length = 0;
var locationid=locationid;
var i;
document.myform_c.wgq_type_c.options[0] = new Option('地区','');
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.myform_c.wgq_type_c.options[document.myform_c.wgq_type_c.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</script>
<!--------------------两个表--------------------------------------->
表1:location
字段名:
locationid
locationname
表2: district
districtid
locationid
districtname
<!------------------------------------------------------------------>
哪位高手帮我指点一下。。感激不尽///