微博客
<div id="marquees">

<a href="#">你可曾有过无数的梦想,</a><br>

<br>

<a href="#">却在时光的流逝里幻灭 </a><br>

<br>

<a href="http://www.wangyeba.com">你可曾对未来期待憧憬,</a><br>

<br>

<a href="#">却在成长的岁月中迷失</a><br>

<br>

</div>

<script language="JavaScript">

marqueesHeight
=200;

stopscroll
=false;

with(marquees){

style.width
=0;

style.height
=marqueesHeight;

style.overflowX
="visible";

style.overflowY
="hidden";

noWrap
=true;

onmouseover
=new Function("stopscroll=true");

onmouseout
=new Function("stopscroll=false");

}

document.write(
'<div id="templayer" style="position:absolute;z-index:1;visibility:hidden"></div>');

preTop
=0; currentTop=0;

function init(){

templayer.innerHTML
="";

while(templayer.offsetHeight<marqueesHeight){

templayer.innerHTML
+=marquees.innerHTML;

}

marquees.innerHTML
=templayer.innerHTML+templayer.innerHTML;

setInterval(
"scrollUp()",30);

}

document.body.onload
=init;

function scrollUp(){

if(stopscroll==truereturn;

preTop
=marquees.scrollTop;

marquees.scrollTop
+=1;

if(preTop==marquees.scrollTop){

marquees.scrollTop
=templayer.offsetHeight-marqueesHeight;

marquees.scrollTop
+=1;

}

}

</script>
posted on 2009-10-14 11:36  飞鸟42  阅读(6009)  评论(1编辑  收藏  举报