title: Best practice for using window.onload
body: <p>I develop Joomla websites/components/modules and plugins and every so often I require the ability to use JavaScript that triggers an event when the page is loaded.  Most of the time this is done using the <code>window.onload</code> function.</p>
  
  <p><strong>My question is:</strong> </p>
  
  <ol>
  <li>Is this the best way to trigger JavaScript events on the page loading or is there a better/newer way?</li>
  <li>If this is the only way to trigger an event on the page loading, what is the best way to make sure that multiple events can be run by different scripts?</li>
  </ol>