<div class="title" id="test" onclick="OpenCloseBox();" >展开 </div>
<script language="javascript">
function OpenCloseBox(){
if (document.getElementById("test").innerHTML == "展开 "){
document.getElementById("ID_Box").className="box1";
document.getElementById("test").innerHTML = "收缩 ";
}else {
document.getElementById("ID_Box").className="box2";
document.getElementById("test").innerHTML = "展开 ";
}
}
</script>
<script language="javascript">
function OpenCloseBox(){
if (document.getElementById("test").innerHTML == "展开 "){
document.getElementById("ID_Box").className="box1";
document.getElementById("test").innerHTML = "收缩 ";
}else {
document.getElementById("ID_Box").className="box2";
document.getElementById("test").innerHTML = "展开 ";
}
}
</script>
<style>
.box1{background:#dedede;font-size:14px;height:50px; width:400px;}
.box2{background:#f00;height:150px; width:400px;}
.title{background:#ccc;margin:10px 0px;cursor:pointer; line-height:25px;width:400px; cursor:pointer;}
</style>
<div id="ID_Box" class="box1">11111 <br/>2222 <br/>222 <br/>3333 </div>
<div class="title" onclick="OpenBox(this)">展开</div>
<!-- div class="title" onclick="CloseBox()">收缩 </div> -->
<script language="javascript">
function OpenBox(obj)
{
document.getElementById("ID_Box").className=(obj.innerText=="展开")?"box2":"box1";
obj.innerText=(obj.innerText=="展开")?"收缩":"展开";
}
//function CloseBox(obj)
//{document.getElementById("ID_Box").className="box1";obj.onclick=OpenBox;obj.innerText="展开"}
</script>