代码已经改进,改进后的代码可以一直向上滚动!设置滚动速度的语句是var speed=100,设置滚动的速度,数值越小,滚动越快!具体位置请查看代码。
<DIV id=demo style="overflow:hidden;height :200px;width :95px;background-color:green;color:#ffffff;
" align=center>
<DIV id=demo1>
<!-- 定义图片 -->
<IMG src=/wl/UploadFiles_5260/200606/20060603012847605.gif>
<IMG src=smlogo2.gif>
<IMG src=/wl/UploadFiles_5260/200606/20060603012847605.gif>
<IMG src=smlogo2.gif>
<IMG src=/wl/UploadFiles_5260/200606/20060603012847605.gif>
<IMG src=smlogo2.gif>
<IMG src=/wl/UploadFiles_5260/200606/20060603012847605.gif>
<IMG src=smlogo2.gif>
<IMG src=/wl/UploadFiles_5260/200606/20060603012847605.gif>
<IMG src=smlogo2.gif>
</DIV>
<DIV id=demo2>
</DIV>
</DIV>
</DIV>
<SCRIPT>
var speed=100 //设置滚动的速度,数值越小,滚动越快!
while(demo.offsetHeight-demo1.offsetHeight > 0){
demo1.innerHTML+=demo1.innerHTML
}
demo2.innerHTML=demo1.innerHTML
function Marquee(){
if(demo2.offsetTop-demo.scrollTop<=0)
demo.scrollTop-=demo1.offsetHeight
else{
demo.scrollTop++
}
}
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function(){clearInterval(MyMar)}
demo.onmouseout=function(){MyMar=setInterval(Marquee,speed)}
</SCRIPT>
了解更多请访问:
http://www.ndfweb.cn/news-85.html