如果在window onload事件中,想让某个函数最先执行,该怎么办呢?方法如下:
function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { oldonload(); func(); } } }
如果在window onload事件中,想让某个函数最先执行,该怎么办呢?方法如下:
function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { oldonload(); func(); } } }