를 선택할 수있는 약간의 CSS로 볼 수있는 요소을 설정하여 : 어쩌면 가장 효율적인 방법하지만 (작동합니다. 부모 요소의 클래스
CSS :.
<style type="text/css">
#Parent.both .left { float: left; width: 50%; }
#Parent.both .right { float: left; width: 50%; }
#Parent.left .right { display: none; }
#Parent.right .left { display: none; }
</style>
자바 스크립트 :
<script type="text/javascript">
function show(c) {document.getElementById('Parent').className=c;}
</script>
,
HTML :
<div id="Parent" class="both">
<div class="left">left</div>
<div class="right">right</div>
</div>
<input type="button" value="both" onclick="show('both');" />
<input type="button" value="left" onclick="show('left');" />
<input type="button" value="right" onclick="show('right');" />
당신이 다시 눈에 보이지 않는 하나를 확장 하시겠습니까? 크기를 애니메이션으로 변경 하시겠습니까? – Glenn