A simple way to add multiple events to onload in JavaScript
If you have existing functions on the onload event, you can add other functions without breaking the existing ones as follows:
var oldEvt = window.onload;
window.onload = function() { if (oldEvt) oldEvt(); doOtherStuffHere(); }
Lifted from one of the comments on http://simonwillison.net/2004/May/26/addLoadEvent/
The above method is useful if there are multiple external javascript files that may use the onload events. If you are sure there aren’t any external javascript files you could use a simpler version:
window.onload = function (firstFunction(); secondFunction();)
