页面存在多个setInterval

var firstInterval;
var secondInterval;

function firstFunction(){
     if(firstInterval) clearInterval(firstInterval);
      //code...
      firstInterval = setInterval('firstFunction()', 1000);
}


function secondFunction(){
    if(secondInterval) clearInterval(secondInterval);
        secondInterval = setInterval('secondFunction()', 2000);
}
原文地址:https://www.cnblogs.com/Doduo/p/8004464.html