var speedp=30 demo2p.innerHTML=demo1p.innerHTML function Marqueep(){ if(demo2p.offsetTop-demop.scrollTop<=0) demop.scrollTop-=demo1p.offsetHeight else{ demop.scrollTop++ } } var MyMarp=setInterval(Marqueep,speedp) demop.onmouseover=function() {clearInterval(MyMarp)} demop.onmouseout=function() {MyMarp=setInterval(Marqueep,speedp)}