一种网页进度条[网页特效] dn001 2009-06-21 08:25:59 循环不间断向上滚动的文本特效代码,可以当作网站公告也可以调整文字滚动的速度,还可以实现鼠标放上面停止滚动,鼠标离开又继续滚动。 <html> <head> <title>不间断循环向上滚动的文本特效</title> </head> <body> <div id="marquees"> <a href="#">网页教学网knowsky.com欢迎您1</a><br> <br> <a href="#">网页教学网knowsky.com欢迎您2</a><br> <br> <a href="#">网页教学网knowsky.com欢迎您3</a><br> <br> <a href="#">网页教学网knowsky.com欢迎您4</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()",10); } document.body.onload=init; function scrollUp(){ if(stopscroll==true) return; preTop=marquees.scrollTop; marquees.scrollTop+=1; if(preTop==marquees.scrollTop){ marquees.scrollTop=templayer.offsetHeight-marqueesHeight; marquees.scrollTop+=1; } } </script>