title: Why does window.onload work while document.onload doesn't?
body: <p>Can anyone tell me why the following page doesn't trigger an alert when it loads? If I use <code>window.onload</code> instead of <code>document.onload</code> it works. Why is there this difference?    </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;script type="text/javascript"&gt;
  
  document.onload = function() {
      alert('Test');
  }
  
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>