页面存在多个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);
}

 

posted @ 2017-12-08 11:09  CorderBob  阅读(527)  评论(0编辑  收藏  举报