返回值问题
var sec = document.getElementById("second"); var i = 5; var timer = setInterval(function(){ i--; sec.innerHTML = i; if(i==1){ window.location.href = "http://www.imooc.com/"; } },1000);
为什么setInterval需要返回一个timer?
var sec = document.getElementById("second"); var i = 5; var timer = setInterval(function(){ i--; sec.innerHTML = i; if(i==1){ window.location.href = "http://www.imooc.com/"; } },1000);
为什么setInterval需要返回一个timer?
2016-09-05
举报