日期:2014-05-18  浏览次数:20668 次

如何实现根据select1中的选项动态选择另外两个select来显示?
比如select1为是否老师。value为0和1。选择0时,后面显示另外一个select2,选择1时,显示select3。
大家帮下忙

------解决方案--------------------
把select2 select3 分别包在两个 <div> 中,根据select1传递的直来来判断显示哪个 <div> ,给个思路.
------解决方案--------------------
<html>
<head>
<script language= "javascript ">
function change(obj){
var v_value = obj.options[obj.options.selectedIndex].value;
if(v_value==1){
document.getElementById( "s1 ").style.visibility= " ";
document.getElementById( "s2 ").style.visibility= "hidden ";
}else{
document.getElementById( "s1 ").style.visibility= "hidden ";
document.getElementById( "s2 ").style.visibility= " ";
}
}
</script>
</head>
<body>
<form>
<table>
<select id= "s0 " onChange= "change(this) ">
<option value= "1 "> 1
<option value= "2 "> 2
</select>

<select id= "s1 " >
<option> 3
<option> 4
</select>

<select id= "s2 " style= "visibility:hidden ">
<option> 5
<option> 6
</select>

</table>
</form>
</body>
</html>
------解决方案--------------------
楼上正确的
------解决方案--------------------
是指二级联动吗?