閉じたときに、上の部分が開くのはたぶん、IEのバグのせいだよ。うわーん。
var doc = new Array();
function closeBox(boxID) {
var ctrl = document.getElementById(boxID);
var boxHeight = new Array();
if(ctrl.style.visibility == 'hidden') {
ctrl.style.visibility = 'visible';
ctrl.innerHTML = doc[boxID];
ctrl.style.height = '5em';
} else {
ctrl.style.visibility = 'hidden';
doc[boxID] = ctrl.innerHTML;
ctrl.innerHTML = "";
ctrl.style.height = '0' ;
}
}
<div class="box">
<div id="news">
<h1><a href="javascript:closeBox('box1');">最新情報</a></h1>
</div>
<div id="box1">
<ul>
<li>あひゃ</li>
<li>かくして!</li>
<li>見ちゃイヤ!</li>
</ul>
</div>
</div>
<div class="boxTopics">
<h1>今日のtopics</h1>
<p>閉じたときに、上の部分が開くのはたぶん、IEのバグのせいだよ。うわーん。</p>
</div>
h1 {
margin: 0;
padding: 0;
font-size: 18px;
margin-top: 0px;
margin-bottom: 0px;
}
li {
margin: 0;
padding: 0;
font-size: 100%;
margin-left: 2em;
list-style: square;
}
.boxTopics {
margin-bottom: 50px;
}