<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>runcode </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Author" content="Sheneyan" />
<script type="text/javascript">
var mh =43;//最小高度
var step = 1; //每次变化的px量
var ms = 10;    //每隔多久循环一次
//折叠速度的设置方法
function toggle(o){
if (!o.tid)o.tid = "_" + Math.random() * 100;
if (!window.toggler)window.toggler = {};
if (!window.toggler[o.tid]){
window.toggler[o.tid]={
obj:o,
maxHeight:o.offsetHeight,
minHeight:mh,
timer:null,
action:1
};  }
o.style.height = o.offsetHeight + "px";
if (window.toggler[o.tid].timer)clearTimeout(window.toggler[o.tid].timer);
window.toggler[o.tid].action *= -1;
window.toggler[o.tid].timer = setTimeout("anim('"+o.tid+"')",ms );//注意计时器的用法
}
//通过对象的最小高度和最大高度,判断折叠是否停止
function anim(id){
var t = window.toggler[id];
var o = window.toggler[id].obj;
if (t.action <0){
if (o.offsetHeight <= t.minHeight){
clearTimeout(t.timer);
return;
}
}
else{
if (o.offsetHeight >= t.maxHeight){
clearTimeout(t.timer);
return;
}
}
o.style.height = (parseInt(o.style.height, 10) + t.action * step) + "px";
window.toggler[id].timer = setTimeout("anim('"+id+"')",ms );
}
</script>
<style type="text/css">
div.xx{border:solid 0px; overflow:hidden; width:1024px; }
div.xx h6{border: 0px;border-width:0 0 1px;padding:0;margin:0;height:43px;line-height:43px;cursor:pointer;background:#eee;}
#Layer1 {
position:absolute;
width:200px;
height:115px;
z-index:1;
}
</style>
</head>
<body>
<div class="xx" id="xx">
  <h6 onClick="toggle(document.all.xx)"> <img src="file:///H|/shiyan/images/11_08.jpg" width="1024" height="43"> </h6>
 
  <div>dfgdgdsfgdsfgdsfg </div>
</div>
<table width="100%" cellpadding="2">
  <tr>
    <th bgcolor="#99CCFF" scope="col">&nbsp; </th>
  </tr>
</table>
<SCRIPT LANGUAGE="JavaScript">
<!--
toggle(document.all.xx);
//-->
</SCRIPT>
</body>
</html>