js源码--div实现marquee

<html>
<body>
<div id="div1" style="overflow:hidden;height:18px">
<div id="div2" >
<div id="div3">aaaaaa</div>
<div id="div4">bbbbbb</div>
<div id="div5">cccccc</div>
</div>
<div id="div5">aaaaaa</div>
</div>
</body></html>
<script language="JavaScript">
window.onload
=init;
function init(){
obj1
=document.getElementById("div1");
obj2
=document.getElementById("div2");
obj3
=document.getElementById("div3");
obj4
=document.getElementById("div4");
move();
}

function move(){
obj1.scrollTop
++;
window.status
=obj1.scrollTop+"-"+obj2.offsetHeight
if(obj1.scrollTop>=obj2.offsetHeight){obj1.scrollTop-=obj2.offsetHeight}
time
=setTimeout("move()",20)
if(obj1.scrollTop%18==17){
clearTimeout(time);
setTimeout(
"move()",2000)
}

}

</script>
阅读更多
上一篇asp.net总结(4)
下一篇js源码--树
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭