在线等待:急!急!急! 搜索一下,或到asp搜索,已经很多了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 实现传递代码如下:---------------------------------------<script language="javascript">var aListValue = new Array(2); aListValue["a"] = new Array("1","2");aListValue["b"] = new Array("3");var nCurIndex = null;function setupList(){ if (nCurIndex != document.frmtest.name1.selectedIndex) {nCurIndex = document.frmtest.name1.selectedIndex;var sValue = document.frmtest.name1.options[nCurIndex].value;var i;//remove existing listfor (i=document.frmtest.name2.options.length-1; i >=0 ; i--)document.frmtest.name2.options.remove(i);for (i=0; i < aListValue[sValue].length;i++){var opt = new Option(aListValue[sValue][i],aListValue[sValue][i]);document.frmtest.name2.options.add(opt);} }}</script><body onload="setupList()"><form name="frmtest" action="" method="post">List1: <select name="name1" onchange="setupList()"><option value="a">a</option><option value="b">b</option></select><br>List2:<select name="name2"></select><br></form></body> 实现方法一、因为这种设计数据量一般不多 在页面初装时,利用ASP/JSP程序读取数据库,将两个<select>的数据全部读取出来,并对上述aListValue进行赋值即可实现要求。二、数据量较大时 读取第一个<select>的数据,选择了其中一个选项之后,从数据库读取数据重新生成第二个<select>,这个没有什么难的吧? 我用showModalDialog打开第一个页面,用表单提交后,虽然选择的是 target="_self" ,但是它还是打开一个新页面????怎么办! 执行下面代码:从SQL探测器中发现IIS 不断查询SQL服务器。而使脚本执行时间超出设置时间!问题在那???请指点读分支机构表 的两字段到两数组里<%connstr=application("oa_connectionstring")set conn=server.CreateObject ("adodb.connection")set rs=server.CreateObject ("adodb.recordset")conn.Open connstrdim sqlsql="select distinct 市县 from 分支机构表 "rs.Open sql,connstr,1 ,1 f=rs.RecordCount Response.Write("f is ="&f)%><HTML><HEAD><META NAME="GENERATOR" Content="Microsoft FrontPage 4.0"></HEAD><script language="javascript">var a_muni=new Array();a_muni[0]="请选择";a_muni[1]="";<%temp_i=2municount=0dim munipart()redim munipart(rs.recordcount-1)'response.write"<p>before code is ok"while not rs.eof municount=municount+1 munipart(municount-1)=rs("市县")' response.write("<p>munipart="&munipart(municount-1))%> a_muni[<%=temp_i%>]="<%=rs("市县")%>"; a_muni[<%=temp_i+1%>]="<%=rs("市县")%>";<% temp_i=temp_i+2 rs.movenext wend rs.close %> var village=new array()<% for temp_i=0 to temp_i/2-1 %> village[<%=temp_i%> =new array(); <% next %> village[0][0]="请选择"; village[0][1]=""; <% temp_i=1 while temp_i<=municount %> village[<%=temp_i%>][0]="请选择"; village[<%=temp_i%>][0]=""; <% response.write("munipart[temp_i]"&munipart(temp_i)) sql="select 企业_id ,乡镇 from 分支机构表 where 市县='"&munipart(temp_i)&"'" set rs=conn.execute(sql) temp_j=2 while not rs.eof %> village[<%=temp_i%>][<%=temp_j%>]="<%=rs("乡镇")%>"; village[<%=temp_i%>][<%=temp_j+1%>]="<%=rs("企业_id")%>"; <% temp_j=temp_j+2 rs.movenext wend temp_j=tem_j+1 wend %></script> js分页索引按钮控制左右图片切换效果的实现问题 js怎么做像 腾讯网-我的资讯(今日要闻) 导航左右滚动的的特效 easyui中datagrid绑定返回的json字符串在IE中正常FF显示不了数据 将JS输出改在HTML中 急急急,javascript事件对象的问题? 高手帮忙 怎么样定位呢?比如说点击一下文本筐后,出现的select菜单就紧挨在文本筐的下面 有谁在做 SCORM 标准的课件?急!!! 在框架中如何打印! 还是关于焦点? 頁面隱含密碼 问个简单问题:如果在一个JS中包含另一个JS?
<script language="javascript">
var aListValue = new Array(2);
aListValue["a"] = new Array("1","2");
aListValue["b"] = new Array("3");var nCurIndex = null;function setupList()
{
if (nCurIndex != document.frmtest.name1.selectedIndex)
{
nCurIndex = document.frmtest.name1.selectedIndex;var sValue = document.frmtest.name1.options[nCurIndex].value;var i;
//remove existing list
for (i=document.frmtest.name2.options.length-1; i >=0 ; i--)
document.frmtest.name2.options.remove(i);for (i=0; i < aListValue[sValue].length;i++)
{
var opt = new Option(aListValue[sValue][i],aListValue[sValue][i]);
document.frmtest.name2.options.add(opt);
} }}
</script><body onload="setupList()">
<form name="frmtest" action="" method="post">
List1: <select name="name1" onchange="setupList()">
<option value="a">a</option>
<option value="b">b</option>
</select><br>
List2:
<select name="name2">
</select><br>
</form>
</body>
在页面初装时,利用ASP/JSP程序读取数据库,将两个<select>的数据全部读取出来,并对上述aListValue进行赋值即可实现要求。二、数据量较大时
读取第一个<select>的数据,选择了其中一个选项之后,从数据库读取数据重新生成第二个<select>,这个没有什么难的吧?
target="_self" ,但是它还是打开一个新页面????怎么办!
<%
connstr=application("oa_connectionstring")
set conn=server.CreateObject ("adodb.connection")
set rs=server.CreateObject ("adodb.recordset")
conn.Open connstr
dim sql
sql="select distinct 市县 from 分支机构表 "
rs.Open sql,connstr,1 ,1
f=rs.RecordCount
Response.Write("f is ="&f)
%><HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft FrontPage 4.0">
</HEAD><script language="javascript">var a_muni=new Array();
a_muni[0]="请选择";
a_muni[1]="";
<%
temp_i=2
municount=0
dim munipart()
redim munipart(rs.recordcount-1)
'response.write"<p>before code is ok"
while not rs.eof
municount=municount+1
munipart(municount-1)=rs("市县")
' response.write("<p>munipart="&munipart(municount-1))
%>
a_muni[<%=temp_i%>]="<%=rs("市县")%>";
a_muni[<%=temp_i+1%>]="<%=rs("市县")%>";
<%
temp_i=temp_i+2
rs.movenext
wend
rs.close
%> var village=new array()
<% for temp_i=0 to temp_i/2-1 %>
village[<%=temp_i%> =new array();
<% next %>
village[0][0]="请选择";
village[0][1]="";
<%
temp_i=1
while temp_i<=municount
%>
village[<%=temp_i%>][0]="请选择";
village[<%=temp_i%>][0]="";
<%
response.write("munipart[temp_i]"&munipart(temp_i))
sql="select 企业_id ,乡镇 from 分支机构表 where 市县='"&munipart(temp_i)&"'"
set rs=conn.execute(sql)
temp_j=2
while not rs.eof
%>
village[<%=temp_i%>][<%=temp_j%>]="<%=rs("乡镇")%>";
village[<%=temp_i%>][<%=temp_j+1%>]="<%=rs("企业_id")%>";
<%
temp_j=temp_j+2
rs.movenext
wend
temp_j=tem_j+1
wend
%>
</script>