title: Running javascript code on page load, without using the onload tag
body: <p>How can I run a JavaScript code when the page loads without using the <code>onload</code> tag?</p>
  
  <p>I'm trying to run this script:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function displayLightbox() {
      document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>That displays a lightbox.</p>