0
我不知道很多关于编码和我需要建立这种形式的用3米不同的区域/ div的(A,B,C),其中:3复选框表示同一div(显示:无)
甲 - 总是示出,控制B和C显示
乙 - 如果对一个复选框4中选择
所示 - 如果在复选框1,2和/或3被选中ç所示
所以,我到达了迄今为止是:
<head>
<script type="text/javascript">
<!--
function showMe (it, box) {
var vis = (box.checked) ? "block" : "none";
document.getElementById(it).style.display = vis;
}
//-->
</script>
</head>
<body>
<form>
<input type="checkbox" value="value1" onclick="showMe('div1', this)" />value1
<input type="checkbox" value="value2" onclick="showMe('div1', this)" />value2
<input type="checkbox" value="value3" onclick="showMe('div1', this)" />value3
<input type="checkbox" value="value4" onclick="showMe('div2', this)" />value3
</form>
<div id="div1" style="display:none;">Show Div 1</div>
<div id="div2" style="display:none;">Show Div 2</div>
</body>
的事情是,如果我检查1,2和/或3,分区B正常显示,但如果我取消其中之一,DIV乙隐藏。我需要div B来显示他们其中一个被检查。
为每个复选框分配不同的div将不起作用,因为所有复选框都“激活”了相同的表单区域(div)。
任何建议吗?
YES!它的作品非常漂亮!我提到我爱你吗? = D很多非常感谢! – user971875