<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>
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>
解决方案 »
- JS达人帮个忙
- FCKeditor中一个页面如何使用2个ReplaceTextarea
- 问各位个简单的正则表达式。
- 二级选择的代码,请问那里错了,
- 请教关于循环中的下拉选择的问题
- 请问用JS怎么在页面中的IFRAME中的页面写内容
- 今天做一个jquery功能的时候遇到一个问题,好像是for循环出现了问题,我解决不了,大家帮忙看看哦,先谢谢你们! 代码如下:
- 在JS中的回车事件是什么啊?或者按回车的时候触发事件怎么实现啊?
- 关于一个判断的问题,怎么写?
- 问一下为什么这样不可以得到所以的复选框的值同时赋给一个数组,注意复选框的value是不一样的!
- 如何转换为保留2位小数形式?
- 请教:怎样实现把文本框里面的每个字符转化成16进制数,谢谢~~~~
function moveshow(tempint,offint)
{
offint = offint + scrollASpeed;
var nowheight = tempint + offint;
if(nowheight < showObj2.offsetHeight) //判断 当前高度是否小于 内部DIV的高度
{
//小于 开始滑动
showObj1.style.height = nowheight;
setTimeout("moveshow(" + nowheight + "," + offint + ")",scrollRate); //等待间隔时间 继续触发本事件
}
else
{
showObj1.style.height = 0; //外部div的高度设定成自适应
}
}