//页面数据加载定时器(自动调用并停止)
var cnt = 0;
var timer = setInterval(function() {
//加载内容start
alert('hello world');
//加载内容end
if (++cnt == 2) {
clearInterval(timer);
}
}, 500);
//页面数据加载定时器(每次只调用一次)
setTimeout(function() {
//加载内容start
alert('hello world');
//加载内容end
}, 3000);
//页面数据加载定时器(每隔一段时间调用一次)
setInterval(function() {
//加载内容start
alert('hello world');
//加载内容end
}, 3000);
Javascript的加载事件/定时器
于 2022-07-15 10:44:08 首次发布