Multiple Onload Functions

Here’s a quick way not so good way (see update) of getting multiple javascript functions to be called when the page has finished loading.

Add this to the pages Head section:

 

And then where you need an onload event callback do this:

onload_functions.push(function() {alert('The page loaded...'););

Update:

As pointed out by phihag, this solution isn’t great, instead try using phihag’s code or use jquery and just $(document).ready(function{} {alert('The page loaded...');});.

Bookmark the permalink.

Leave a Reply

Your email address will not be published.