多个checkbox时点击显示和隐藏关系??
HTML code
<input type="checkbox" name="jinbick" onclick="div()" value="0" />
<input type="checkbox" name="jinbick" onclick="div()" value="0" />
<input type="checkbox" name="jinbick" onclick="div()" value="0" />
<input type="checkbox" name="jinbick" onclick="div()" value="0" />
<input type="checkbox" name="jinbick" onclick="div()" value="0" />
<input type="checkbox" name="jinbick" onclick="div()" value="0" />
<input type="checkbox" name="jinbick" onclick="div()" value="0" />
<div id="divcon" style="display:none">显示内容</div>
当我点击上面的某一个显示点击多个时 checkbox 时那么div层显示,如果全部没有被选中那div层隐藏 那么js代码怎么写,请懂的高手 帮忙!!!!
------解决方案--------------------当我点击上面的某一个显示点击多个时 ??兄弟表示没有看懂。。。发个站内信 看似应该很简单 估计要用到this
------解决方案--------------------你自己也说了 当全部选中取消后 div隐藏
也就是 if(每个 checkboc全部处于 checked=false){ hide(div) }
------解决方案--------------------
<html>
<head>
<title> js限制输入长度,支持中英文 </title>
</head>
<body>
<input type= "text " name= "giftDescribe " onkeyup= "if(this.value.length> =10){alert( '您的输入
超过限定长度 ')}else{value=value.replace(/[^\u4E00-\u9FA5]/g, ' ');} "/>
<input type= "checkbox " name= "jinbick " onclick= "div() " value= "0 " />
<input type= "checkbox " name= "jinbick " onclick= "div() " value= "0 " />
<input type= "checkbox " name= "jinbick " onclick= "div() " value= "0 " />
<input type= "checkbox " name= "jinbick " onclick= "div() " value= "0 " />
<input type= "checkbox " name= "jinbick " onclick= "div() " value= "0 " />
<input type= "checkbox " name= "jinbick " onclick= "div() " value= "0 " />
<input type= "checkbox " name= "jinbick " onclick= "div() " value= "0 " />
<div id= "divcon " style= "display:none "> 显示内容 </div>
<script>
function div()
{
var cheLength = document.getElementsByName( "jinbick ");
for(var i=0; i <cheLength.length; i++)
{
if(cheLength[i].checked)
{
document.getElementById( 'divcon ').style.display = "block ";
return;
}
else
{
document.getElementById( 'divcon ').style.display = "none ";
}
}
}
</script>
</body>
</html>