//JS控制div展开与收回
<div id="nb" onClick="show('sb','nb')" style=" width:33px;cursor:pointer">展开</div>
<div id="sb" style=" background-color:#F99;width:50px;height:40px; display:none"></div>
<script>
function show(num,a)
{
var box = document.getElementById(num);
var message = document.getElementById(a);
if(box.style.display != "block")
{
box.style.display = "block";
message.innerHTML = '收起';
}
else
{
box.style.display = "none";
message.innerHTML = '展开';
}
}
</script>
以上代码都是小生自己zhengli的有啥不对的地方请多多指教!