title: Cross-browser compatible way to bind events on page load
body: <p>Using <code>jQuery</code>, I can use the following function to execute code as soon as the <code>DOM</code> has loaded:</p>
  
  <pre><code>$(function() {
      // do stuff here
  });
  </code></pre>
  
  <p>Or equivalently:</p>
  
  <pre><code>$(document).ready(function() { 
      // do stuff here
  });
  </code></pre>
  
  <p>In trying to get a better understanding of raw javascript, I'm using this code to achieve a similar effect:</p>
  
  <pre><code>window.onload = function() {
      // do stuff here
  }
  </code></pre>
  
  <p>Is this method cross-browser compatible? Are there any better ways to achieve this functionality?</p>