<style>
td{font-size:10pt;cursor:hand;}
</style>
<body>
<a herf="javascript:;" onmouseover="aa(this)" inst="1<br>1<br>1<br>1<br>1<br>1<br>1<br>">test1</a>
<a herf="javascript:;" onmouseover="aa(this)" inst="1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>">test2</a>
<div id="div1" style="background-color:#CCCCCC; border:1px #000000 solid; padding:2px;width:100px; overflow-y:hidden"><div id="div2"></div></div>
</body><script>
var scrollSpeed = 8; //滑动速度
var scrollASpeed = 0; //滑动加速度
var scrollRate = 10; //滑动间隔(毫秒)
var showObj1 = document.getElementById("div1"); //外层DIV
var showObj2 = document.getElementById("div2"); //内部DIV
function aa(obj)
{
showObj1.style.height = 1; //初始化外层DIV 起始高度
showObj2.innerHTML = obj.inst; //改变内部DIV 的内容
moveshow(1,scrollSpeed);//激活方法
}
function moveshow(tempint,offint)
{
if(tempint < showObj2.offsetHeight) //判断 当前高度是否小于 内部DIV的高度
{
//小于 开始滑动
offint = offint + scrollASpeed;
var nowheight = tempint + offint;
showObj1.style.height = nowheight;
setTimeout("moveshow(" + nowheight + "," + offint + ")",scrollRate); //等待间隔时间 继续触发本事件
}
else
{
showObj1.style.height = 0; //外部div的高度设定成自适应
}
}
</script>