求下拉框连动代码 求下拉框连动的实现代码!! 谢谢!!!!!!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 将autopostback属性设为TRUE即可,但会刷新整个页面,也可用ajax解决。。效果更好 http://www.cnblogs.com/singlepine/archive/2005/10/29/264668.html http://www.cnblogs.com/singlepine/archive/2005/10/19/257954.html 用ajax也可以,但我还是喜欢用javascript的来实现..相关代码,网上有类似的...你搜索省市联动即可. 最好用js实现,免得增加服务器的开销,给你个例子<form name="frm"><select name="s1" size="1" onChange="redirec1(document.frm.s1.options.selectedIndex)"> <option selected >浙江</option> <option >江苏</option></select><select name="s2" size="1" onChange="redirec2(document.frm.s1.options.selectedIndex,document.frm.s2.options.selectedIndex)"> <option selected>杭州</option><option>金华</option></select><select name="s3" size="1"> <option selected>富阳</option><option>萧山</option></select></form><script language="javascript">var select2 = new Array(new Array(new Option("杭州"),new Option("金华")),new Array(new Option("苏州"),new Option("连云港")));var select3 = new Array(new Array(new Array(new Option("富阳"),new Option("萧山")),new Array(new Option("永康"),new Option("义务"))),new Array(new Array(new Option("aa"),new Option("aaa"),new Option("aaaa"),new Option("aaaaa")),new Array(new Option("bb"),new Option("bbb"))));function redirec1(x){ var temp = document.frm.s2; temp.length=0 for (i=0;i<select2[x].length;i++) { temp.options[i]=new Option(select2[x][i].text); }redirec2(document.frm.s1.options.selectedIndex,document.frm.s2.options.selectedIndex)}function redirec2(x,y){ var temp = document.frm.s3; temp.length=0 for (i=0;i<select3[x][y].length;i++) { temp.options[i]=new Option(select3[x][y][i].text); }}</script> 求助:asp网站新闻文章标题 ,后边自动显示发布的日期, 想自动生成,代码怎么写啊? 百度地图如何用代码实现“轨迹回放”和“跟踪”这2个功能? 怎么用JS存储到xml文件中和从xml文件中读取数据出来 问一正则的问题 oracle 中的 select 怎么用? 征求大家意见,高手给些建议! 请看下我的这几句代码哪里错了啊?谢谢~5分 自定义控件中按钮的事件问题。请知道的指教,急急! 如何在.net中取得硬件系列号 高手救命:重建了一个.NET运行环境后,我的ASPX连不上数据库了! 新人100分求 DataList里面的一个问题 有关有IIS安装的问题,很急!!!!!
也可用ajax解决。。效果更好
相关代码,网上有类似的...你搜索省市联动即可.
<form name="frm">
<select name="s1" size="1" onChange="redirec1(document.frm.s1.options.selectedIndex)">
<option selected >浙江</option>
<option >江苏</option>
</select><select name="s2" size="1" onChange="redirec2(document.frm.s1.options.selectedIndex,document.frm.s2.options.selectedIndex)">
<option selected>杭州</option>
<option>金华</option>
</select><select name="s3" size="1">
<option selected>富阳</option>
<option>萧山</option>
</select>
</form>
<script language="javascript">
var select2 = new Array(new Array(new Option("杭州"),new Option("金华")),new Array(new Option("苏州"),new Option("连云港")));
var select3 = new Array(new Array(new Array(new Option("富阳"),new Option("萧山")),new Array(new Option("永康"),new Option("义务"))),new Array(new Array(new Option("aa"),new Option("aaa"),new Option("aaaa"),new Option("aaaaa")),new Array(new Option("bb"),new Option("bbb"))));
function redirec1(x)
{
var temp = document.frm.s2;
temp.length=0
for (i=0;i<select2[x].length;i++)
{
temp.options[i]=new Option(select2[x][i].text);
}
redirec2(document.frm.s1.options.selectedIndex,document.frm.s2.options.selectedIndex)}function redirec2(x,y)
{
var temp = document.frm.s3;
temp.length=0
for (i=0;i<select3[x][y].length;i++)
{
temp.options[i]=new Option(select3[x][y][i].text);
}
}
</script>