首页 > 代码库 > SetInterval_1

SetInterval_1

window.onload = function () {
timer = setInterval(autoRedirect, 1000);
}
var timer = null;
var flag = 5;

function autoRedirect()
{
lb.innerText = flag.toString() + "faf";
flag = flag - 1;

if (flag == 0) {
location.href = "http://www.mamicode.com/Users/Home.aspx";
clearInterval(timer);
}
}

SetInterval_1