给你个类似效果代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type='text/javascript'> </script>
<style type="text/css">
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background="../src/back.gif";
font-size:12px;
}
</style>
</head>
<body>
<input type='button' onclick='showTable(this)' value='收缩'>
<div id='briefInfo' style="width:160px; height:90px; background-color:#f4f4f4;overflow:hidden; " >
asdfasdfasdfasdfasdfklasjdflkjasldfk<br/>jalsdkfjlaskdfjlaksjdfl<br/>kajsldfkjalskfja<br/>sdfjlaksjdflkaj<br/>sldfkjalsdkfj<br/>lskdfjlaskdfjlksfjlsjdfklj
</div>
<script language="JavaScript">
var s;
var div=document.getElementById("briefInfo");
div.sign=false;
var button=document.getElementsByTagName("input")[0];
function showTable(){
//var divHeight=parseInt(div.style.height);
if(div.sign==false){
div.style.height=parseInt(div.style.height)-1+"px"; if(parseInt(div.style.height)<=0){
div.style.height="0px";
clearTimeout(s);
button.value='展开';
div.sign=true;
return
}
}else{
div.style.height=parseInt(div.style.height)+1+"px";
if(parseInt(div.style.height)>=90){
div.style.height="90px";
clearTimeout(s);
button.value='收缩';
div.sign=false;
return;
}
}
s=setTimeout(showTable,10);
}
</script>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type='text/javascript'> </script>
<style type="text/css">
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background="../src/back.gif";
font-size:12px;
}
</style>
</head>
<body>
<input type='button' onclick='showTable(this)' value='收缩'>
<div id='briefInfo' style="width:160px; height:90px; background-color:#f4f4f4;overflow:hidden; " >
asdfasdfasdfasdfasdfklasjdflkjasldfk<br/>jalsdkfjlaskdfjlaksjdfl<br/>kajsldfkjalskfja<br/>sdfjlaksjdflkaj<br/>sldfkjalsdkfj<br/>lskdfjlaskdfjlksfjlsjdfklj
</div>
<script language="JavaScript">
var s;
var div=document.getElementById("briefInfo");
div.sign=false;
var button=document.getElementsByTagName("input")[0];
function showTable(){
//var divHeight=parseInt(div.style.height);
if(div.sign==false){
div.style.height=parseInt(div.style.height)-1+"px"; if(parseInt(div.style.height)<=0){
div.style.height="0px";
clearTimeout(s);
button.value='展开';
div.sign=true;
return
}
}else{
div.style.height=parseInt(div.style.height)+1+"px";
if(parseInt(div.style.height)>=90){
div.style.height="90px";
clearTimeout(s);
button.value='收缩';
div.sign=false;
return;
}
}
s=setTimeout(showTable,10);
}
</script>
</body>
</html>
http://extjs.com/deploy/dev/examples/panel/panels.html
在ExtJS只需很少的代码,就能实现效果。