var timer = window.setInterval(function(){ function();//要执行的方法 },1000 * 3); //根据返回的ID可以停止定时 clearInterval(timer);