关于用JS实现三联动,高手快进来啊 ,急! 需求: 我现在有三个select标签, 每一个里面都有多个option , 我想要实现的效果是:当我选中第一个select中的第一个option时,后面两个select分别只显示第一个option, 当我选中第一个select中的第二个option时,后面两个select分别只显示第二个option,依此类推. 希望哪位高手能贴点代码,先谢谢啦 ! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <select onchange='setSelect(this)'></select><select id='slc2'></select><select id='slc3'></select>function setSelect(slc){document.getElementById("slc2").selectedIndex = slc.selectedIndex ;document.getElementById("slc3").selectedIndex = slc.selectedIndex ;} <html> <head> <script type="text/javascript"> function clickSel() { var sel1 = document.getElementById("sel1"); var sel2 = document.getElementById("sel2"); var sel3 = document.getElementById("sel3"); sel2.selectedIndex = sel3.selectedIndex = sel1.selectedIndex; sel2.onfocus = function() { var index = this.selectedIndex; this.onchange = function() { this.selectedIndex = index; }; }; } </script> </head> <body> <select id="sel1" onchange="clickSel()"> <option>opts1</option> <option>opts2</option> <option>opts3</option> <option>opts4</option> <option>opts5</option> <option>opts6</option> </select> <select id="sel2"> <option>opts1</option> <option>opts2</option> <option>opts3</option> <option>opts4</option> <option>opts5</option> <option>opts6</option> </select> <select id="sel3"> <option>opts1</option> <option>opts2</option> <option>opts3</option> <option>opts4</option> <option>opts5</option> <option>opts6</option> </select> </body></html> 使用JS调用某网址下的内容 EXT CHART 问题 EXT 求救 滚动条到最后的事件 window.onbeforeunload确定后页面不关闭??? 急急,,高手请进,在线等。。。 在线等待:菜人问个菜问题,请大侠指点 如何用window.open新建一个全屏的窗口? 两个父子窗口传递数据的难题(急)! 为什么我用jquery不能控制下划线的css属性呢? 置顶 上移 下移 置底 删除 麻烦各位帮忙看看,s 帮解决一点小问题frame的应用! JS 如何实现类似 Google Map 地图信息窗口功能
<select id='slc2'></select>
<select id='slc3'></select>function setSelect(slc)
{
document.getElementById("slc2").selectedIndex = slc.selectedIndex ;
document.getElementById("slc3").selectedIndex = slc.selectedIndex ;
}
<head>
<script type="text/javascript">
function clickSel() {
var sel1 = document.getElementById("sel1");
var sel2 = document.getElementById("sel2");
var sel3 = document.getElementById("sel3");
sel2.selectedIndex = sel3.selectedIndex = sel1.selectedIndex;
sel2.onfocus = function() {
var index = this.selectedIndex;
this.onchange = function() {
this.selectedIndex = index;
};
}; }
</script>
</head>
<body>
<select id="sel1" onchange="clickSel()">
<option>opts1</option>
<option>opts2</option>
<option>opts3</option>
<option>opts4</option>
<option>opts5</option>
<option>opts6</option>
</select>
<select id="sel2">
<option>opts1</option>
<option>opts2</option>
<option>opts3</option>
<option>opts4</option>
<option>opts5</option>
<option>opts6</option>
</select>
<select id="sel3">
<option>opts1</option>
<option>opts2</option>
<option>opts3</option>
<option>opts4</option>
<option>opts5</option>
<option>opts6</option>
</select>
</body>
</html>