There are two methods of interest here: setInterval () and clearInterval().
Presumably, we would need to play the frames of a sequence in a loop. We would call
setInterval() like this:
var Interval = setInterval ("MultiSelect()", 500);
By saving a reference to the current interval, we can pause the animation with clearInterval().
Refer your friends to this blog: