﻿//连续不间断滚动

function Marquee(FrameElement,speed){
    this.FrameElement=FrameElement;
    this.speed=speed;
    this.Start=Start;
    this.Stop=Stop;
    this.sp1=FrameElement.childNodes[0].childNodes[0].childNodes[0].childNodes[0];
    this.sp2=null;
    this.Mar=null;
    this.Go=Go;
    this.FrameElement.setAttribute("Marquee",this);
    if(this.FrameElement.offsetWidth<sp1.offsetWidth){
        var sp2Element=sp1.cloneNode(true)
        this.sp2=FrameElement.childNodes[0].childNodes[0].childNodes[0].appendChild(sp2Element);
        this.Start();
        this.FrameElement.attachEvent("onmouseover",new Function(this.FrameElement.id+".Marquee.Stop()"))
        this.FrameElement.attachEvent("onmouseout",new Function(this.FrameElement.id+".Marquee.Start()"))
    }
}

function Start(){
    this.Mar=setInterval(this.FrameElement.id+".Marquee.Go()",this.speed) 
}

function Go(){
    if(this.sp2.offsetWidth-this.FrameElement.scrollLeft<=0) {
       this.FrameElement.scrollLeft-=this.sp1.offsetWidth 
    }else{
       this.FrameElement.scrollLeft++; 
    }
}

function Stop(){
    if(this.Mar!=null){
        clearTimeout(this.Mar);
    }
}






 

