The example of this article describes JS based on Msclass and setinterval to achieve AJAX timing acquisition information and scrolling display method. Share to everyone for your reference, specific as follows:
SetTimeout is used for a delay, only once.
SetInterval: for multiple executions.
The project refers to the jquery.timers-1.2.js timer, and Msclass do the information on a regular basis, every 3 minutes, execute three times, rolling more and more quickly, because timers and msclass are used setinterval,
Adds a setinterval, which eventually results in several setinterval concurrency, so it's very fast to clearinterval the last setinterval at the time of the call, or to reference the original method of the Msclass author.
//Timer first execute destroy instance var Marquee1 = new Marquee (["Div1", "Content"]) function Marquee_everytime () {Marquee1.destroy ();//Destroy Instance Application Getmarqueeinfo ();
Then Ajax collects the required information data. }//ajax Method function Getmarqueeinfo () {Lg.ajax ({type: ' Ajaxother ', Methods: ' Getmarqueeinfo ', success:funct
Ion (data, tipscontent) {$ ("#Content"). HTML ("");
$ ("#Content"). HTML (tipscontent); Large Container | Small container | rolling direction | rolling Speed | Width of large Container | Height of the large container | Rolling Break | Rolling Break |
Scrolling end time marquee1.direction = 2;
Marquee1.step = 0.4;
Marquee1.width = 640;
Marquee1.height = 30;
Marquee1.timer = 20;
Marquee1.delaytime = 4000;
Marquee1.waittime = 3000;
Marquee1.scrollstep = 320;
Marquee1.start ();
}, Error:function () {lg.tip (' information loading failed. ');
}
}); }
More readers interested in JavaScript-related content can view this site: "JavaScript Ajax Operating Skills Summary", "JavaScript switching effects and techniques summary", "JavaScript Search Algorithm Skills summary", " JavaScript animation effects and tips Summary, "JavaScript Error and debugging skills Summary", "JavaScript data structure and algorithm skills summary", "JavaScript traversal algorithm and Skills summary" and "JavaScript Mathematical operation Usage Summary"
I hope this article will help you with JavaScript programming.