js实现 页面加载 完成 后顺序 执行
function addLoadEvent(func){ var oldonLoad = window.onload; if(typeof window.onload != 'function'){ window.onload = func; }else{ window.onload = function(){ oldonLoad(); func(); } } } function c1(){ console.log(1) } function c2(){ console.log(2) } function c3(){ console.log(3) } addLoadEvent(c3) addLoadEvent(c1) addLoadEvent(c2)