急,二级连动怎样让所选择的经过连动查询后还处于被选状态。分不够可再加。

nothingall 2005-04-23 10:14:07
<!-----------------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
<!------------------------------------------------------------------>
哪位高手帮我指点一下。。感激不尽///
...全文
109 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
nothingall 2005-04-23
  • 打赏
  • 举报
回复
如果你走过请帮一下我这个菜鸟,谢谢。。
itzhiren 2005-04-23
  • 打赏
  • 举报
回复
学习
nothingall 2005-04-23
  • 打赏
  • 举报
回复
选择后我用了两个变量接过来值,省份的简单在Option做个判断即可
<%if rs1("locationid")=cint(biglocation_c) then%>selected<%end if%>
而城市的是且javascript的数组我应在哪里做判断输出selected?应怎样改写?

~~~~~~~~~
写入COOKIE,这个我更昏。本人实在有点菜,希望大家帮助一下。。谢谢。。
mrshelly 2005-04-23
  • 打赏
  • 举报
回复
选择后写入COOKIE。
chjpeng 2005-04-23
  • 打赏
  • 举报
回复
应该是:
if (citys[i][2]==citysvalue)
{
document.all.City.options[document.all.City.length] = new Option(citys[i][1], citys[i][2],false,true);
}
else
{
document.all.City.options[document.all.City.length] = new Option(citys[i][1], citys[i][2],false,false);
}

chjpeng 2005-04-23
  • 打赏
  • 举报
回复
...就是下面这段代码。。。

if (citys[i][2]==citysvalue)
{
document.all.area2.options[document.all.City.length] = new Option(citys[i][1], citys[i][2],false,true);
}
else
{
document.all.area2.options[document.all.City.length] = new Option(citys[i][1], citys[i][2],false,false);
}
nothingall 2005-04-23
  • 打赏
  • 举报
回复
谁来帮我?
nothingall 2005-04-23
  • 打赏
  • 举报
回复
没人理我?

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧