信息栏循环滚动
2017-10-30 本文已影响17人
LuckyS007
<div id="id">
#d1
#d2
</div >
function toutiaoScroll(){
var speed=90
var news=document.getElementById("id");
var news1=document.getElementById("d1");
var news2=document.getElementById("d2");
news2.innerHTML=news1.innerHTML
function Marquee(){
if(news.scrollTop>=news1.offsetHeight){
news.scrollTop=0;
}
else{
news.scrollTop=news.scrollTop+1;
}
}
var MyMar=setInterval(Marquee,speed)
news.onmouseover=function(){clearInterval(MyMar)}
news.onmouseout=function(){MyMar=setInterval(Marquee,speed)}
}
toutiaoScroll();