1.共享onload事件:
方法一:
window.onload = function(){
firstFunction();
secondFunction();
.......
}
方法二:
function addLoadEvent(func) {
var oldLoad = window.onload;
if(typeof window.onload != 'function) {
window.onload = func;
} else {
oldLoad();
func();
}
}
网友评论