js监控页面加载完成后执行action
//Some scripts require that you run something immediately after the web page finishes loading.
var start;
window.onload = function () {
if(document.all) {// 简单判断是否是IE
start = setInterval('init()', 200);
} else {
var element = document.getElementById("fade");
element.style.display="none";
}
};
function init() {
if (document.readyState == "complete") {
try{
var element = document.getElementById("fade");
element.style.display="none";
clearInterval(start);// 执行成功,清除监听
}catch(err){return true;}
}
}
// 注:document.readyState 在firefox 中不起效果, 所以要用window.onload 时间出发firefox, 如果 window.onload 确定是在页面加载完成后执行,
监控页面是否加载完成,就不需要
// 这段代码了.
if(document.all) {// 简单判断是否是IE
start = setInterval('init()', 200);
}
现在不清楚 window.onload 是否是页面加载时 还是加载后执行,网上说是在加载后,执行...
相关推荐
88274956 2020-11-03
runner 2020-09-01
梦的天空 2020-08-25
移动开发与培训 2020-08-16
ReunionIsland 2020-08-16
lyqdanang 2020-08-16
MyNameIsXiaoLai 2020-07-08
星辰的笔记 2020-07-04
csstpeixun 2020-06-28
letheashura 2020-06-26
liaoxuewu 2020-06-26
sunzhihaofuture 2020-06-21
FEvivi 2020-06-16
坚持着执着 2020-06-16
waterv 2020-06-14
xiaoge00 2020-06-14
firejq 2020-06-14
firstboy0 2020-06-14
e度空间 2020-06-12
zhongweinan 2020-06-10