再次更新!MSClass (Class Of Marquee Scroll通用不间断滚动JS封装类 V

2019-06-03 07:16:13王振洲

很不错。

不过演示代码的new Marquee("marquee",0,1,760,52,50,5000,3000)那么多参数看了让人有点迷糊,呵呵,做成这种模式可能让人看得懂一些:

function Marquee() 

    this.ID = document.getElementById(arguments[0]); 
    this.Direction = arguments[1]; 
    this.Step = arguments[2]; 
    this.Width = arguments[3]; 
    this.Height = arguments[4]; 
    this.Timer = arguments[5]; 
    this.WaitTime = arguments[6]; 
    this.StopTime = arguments[7]; 
    this.CTL = this.StartID = this.Stop = this.MouseOver = 0; 
    this.ID.style.overflowX = this.ID.style.overflowY = "hidden"; 
    this.ID.noWrap = true; 
    this.ID.style.width = this.Width; 
    this.ID.style.height = this.Height; 
    this.ID.innerHTML += this.ID.innerHTML; 
}  


然后使用:

var m = new Marquee; 
m.ID = document.getElementById("marquee"); 
m.Direction = 0; 
m.Step = 1; 
m.Width = 760; 
// ...... 
m.Start(m, m.Timer, m.WaitTime, m.StopTime); 

m.Start的参数好像都和m有关,可以省略掉?