function firstFuntion(){ console.log("我是first啊"); } function secondFuntion(){ console.log("我是second啊"); } function addLoadEvent(func){ var oldonload = window.onload; if(typeof window.onload != 'function'){ window.onload = func; }else{ window.onload = function(){ oldonload(); func(); console.log("队列成功了"); } } } addLoadEvent(firstFuntion); addLoadEvent(secondFuntion);