title: How to detect document.ready in JavaScript?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/799981/document-ready-equivalent-without-jquery">$(document).ready equivalent without jQuery</a>  </p>
  </blockquote>
  
  
  
  <p>I have a framework-less javascript that executes on load:</p>
  
  <pre><code>function myJs() {    
     // some code
  }
  window.load = myJs;
  </code></pre>
  
  <p>But this causes a delay in the execution of the script. I want to be able to execute this script as soon as the document is ready to be manipulated even before the page has completely finished loading. How can this be done in a cross browser compatible way? In other words how can the: </p>
  
  <pre><code>$(document).ready(function() {  
     //
  });
  </code></pre>
  
  <p>of jQuery be said in plain JS?</p>