/ Published in: JavaScript
Not my Code, credit is in the URL.
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() { if (oldonload) { oldonload(); } func(); } } } addLoadEvent(nameOfSomeFunctionToRunOnPageLoad); addLoadEvent(function() { /* more code to run on page load */ });
URL: http://www.webreference.com/programming/javascript/onloads/