/ Published in: JavaScript
Use this function to queue functions you wish to load on window onload. Very useful when code becomes complex.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { oldonload(); func(); } } } //usage addLoadEvent(firstFunction); addLoadEvent(secondFunction);