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

js+div 实现多选
通过js控制div层,实现多选.例如;
按钮             div层
A                   --A
B                   --B
C                   --C

就是说点   A     div层实现对A的显示,再此点A   对应的div隐藏.
如果   我点了A\B\C   三个   就出现三个   相应的   A\B\C的   div层



------解决方案--------------------
用个单击函数 使3个层隐藏或显示就行啊
------解决方案--------------------
div1.style.display= "none ";
div1.style.display= " ";
------解决方案--------------------
分别为三个DIV设置一个ID名:
<div id = "a " > 你要显示的内容 </div>
<div id = "b " > 你要显示的内容 </div>
<div id = "c " > 你要显示的内容 </div>
三个按钮:
<input type= "button " name = "aa " value= "A " onclick = "a() "/>
<input type= "button " name = "bb " value= "B " onclick = "b() "/>
<input type= "button " name = "cc " value= "C " onclick = "c() "/>

<script language= "javascript ">
function a(){
document.form.all( "a ").style.visibility= "visible ";
}
function b(){
document.form.all( "b ").style.visibility= "visible ";
}
function c(){
document.form.all( "c ").style.visibility= "visible ";
}
</script>