/ Published in: JavaScript
URL: http://simonwillison.net/2004/May/26/addLoadEvent/
Description: Execute different functions when the page loads in a better way than default onload JS event. Include it in the end of the JS document. Arguments: Name of the function that you want to execute when the page loads. Author: Simon Willison
Expand |
Embed | Plain Text
function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { oldonload(); func(); } } }
You need to login to post a comment.
