| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 586 人关注过本帖
标题:[求助]联动菜单里取值的问题
只看楼主 加入收藏
ssmm00
Rank: 1
等 级:新手上路
帖 子:41
专家分:0
注 册:2007-4-27
收藏
 问题点数:0 回复次数:0 
[求助]联动菜单里取值的问题


在这里怎么才能取得“地区”和“list2”的值呢?

<title>无标题文档</title>
<SCRIPT LANGUAGE="JavaScript">
function move(fbox, tbox) {
var arrFbox = new Array();
var arrTbox = new Array();
var arrLookup = new Array();
var i;

for (i = 0; i < tbox.options.length; i++) {
arrLookup[tbox.options[i].text] = tbox.options[i].value;
arrTbox[i] = tbox.options[i].text;
}
var fLength = 0;
var tLength = arrTbox.length;
for(i = 0; i < fbox.options.length; i++) {
arrLookup[fbox.options[i].text] = fbox.options[i].value;
if (fbox.options[i].selected && fbox.options[i].value != "") {
arrTbox[tLength] = fbox.options[i].text;
tLength++;
}
else {
arrFbox[fLength] = fbox.options[i].text;
fLength++;
}
}
arrFbox.sort();
arrTbox.sort();
fbox.length = 0;
tbox.length = 0;
var c;
for(c = 0; c < arrFbox.length; c++) {
var no = new Option();
no.value = arrLookup[arrFbox[c]];
no.text = arrFbox[c];
fbox[c] = no;
}
for(c = 0; c < arrTbox.length; c++) {
var no = new Option();
no.value = arrLookup[arrTbox[c]];
no.text = arrTbox[c];
tbox[c] = no;
}
}
</script>
</head>

<body>
<!---->
<%

Set rssheng= Server.CreateObject("ADODB.Recordset")
sqlsheng="select * from area_sheng order by shengID"
rssheng.open sqlsheng,conn,1,1

dim count
set rs=server.createobject("adodb.recordset")
sql = "select * from area_shi order by shiID asc"
rs.open sql,conn,1,1
%>
<script language = "JavaScript">
var onecount;
subcat = new Array();
<%count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("shiname"))%>","<%= trim(rs("shengid"))%>","<%= trim(rs("shiid"))%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;

function changelocation(locationid)
{
document.form.shiid.length = 1;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.form.shiid.options[document.form.shiid.length] = new Option(subcat[i][0], subcat[i][2]);
document.form.shiid.value =5;
}
}
}
</script>
<table border="0" cellpadding="2" cellspacing="0" align="center">
<form method="post" action="addshow.asp?action=add" name="form">
<tr>
<td height="28">
<select name="shengid" onChange="changelocation(document.form.shengid.options[document.form.shengid.selectedIndex].value)" size="1" style="width:100px" >
<option selected value="">==省份==</option>
<%
if not (rssheng.bof and rssheng.eof) then
rssheng.movefirst
do while not rssheng.eof
response.Write "<option value='" & trim(rssheng("shengid")) & "'>" & trim(rssheng("shengName")) & "</option>"
rssheng.movenext
loop
end if
%>
</select></td>
<td><select name="shiid" size="10" style="width:100px" id="shiid">
<option selected value="">==地区==</option>
</select></td>
<td><input type="button" onClick="move(this.form.list2,this.form.shiid)" value="<<">
<input type="button" onClick="move(this.form.shiid,this.form.list2)" value=">>"></td>
<td><select multiple size="10" name="list2" style="width:150">
</select></td>
</tr>
<tr><td><input type="submit" name="Submit" value="提交" ></td></tr>
</form>
</table>
<!---->
</body>
</html>

搜索更多相关主题的帖子: var 菜单 Array length new 
2007-07-06 17:20
快速回复:[求助]联动菜单里取值的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.048393 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved