var dir=1//每步移动像素,大=快
var speed=30//循环周期(毫秒)大=慢
demo2.innerHTML=demo1.innerHTML
function Marquee(){//正常移动
//alert(demo2.offsetWidth+"\n"+demo.scrollRight)
if (dir>0 && (demo2.offsetWidth-demo.scrollRight)<=0) demo.scrollRight=0
if (dir<0 &&(demo.scrollright<=0)) demo.scrollRight=demo2.offsetWidth
demo.scrollRight+=dir
demo.onmouseover=function() {clearInterval(MyMar)}//暂停移动
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}//继续移动
}
function r_left(){if (dir=1)dir=-1}//换向左移
function r_right(){if (dir=-1)dir=1}//换向右移
你这个代码是自己写的,还是直接从原文件复制过来的?
上面明显是用CSS样式,所以要改,也得从CSS里面改,我修改了一下,你可以看看
var MyMar=setInterval(Marquee,speed)
function r_right(){if (dir=1)dir=-1}//换向右移
function r_left(){if (dir=-1)dir=1}//换向左移