<input type="checkbox" name="checkname" onclick="check(this)"/>左 <input type="checkbox" name="checkname" onclick="check(this)"/>右 <div id="show" style="display:block;">显示</div> <div id="hidden" style="display:none;">隐藏</div> <script type="text/javascript"> function check(obj){ var checks = document.getElementsByName("checkname"); if(obj.checked){ for(var i=0;i<checks.length;i++){ checks[i].checked = false; } obj.checked = true; }else{ for(var i=0;i<checks.length;i++){ checks[i].checked = false; } } document.getElementById(‘show‘).style.display = document.getElementById(‘show‘).style.display=="none"?"block":"none"; document.getElementById(‘hidden‘).style.display = document.getElementById(‘hidden‘).style.display=="none"?"block":"none"; } </script>
时间: 2024-11-05 16:11:50