title: Object.onload in Internet Explorer 6, 7 and 8
body: <p>I have an application that must be able to do the following:</p>
  <pre><code>var script1 = document.createElement('script');
  script1.src = myLocation + 'script1.js';
  script1.type = 'text/javascript';
  document.body.appendChild(script1);
  
  script1.addEventListener('load', function () {
      var script2 = document.createElement('script');
      script2.src = myLocation + 'script2.js';
      script2.type = 'text/javascript';
      document.body.appendChild(script2);
  
      script2.addEventListener('load', function () {
          var script3 = document.createElement('script');
          script3.src = myLocation + 'script3.js';
          script3.type = 'text/javascript';
          document.body.appendChild(script3);
      }, false);
  }, false);
  </code></pre>
  <p>This totally works in every browser, even in IE9. In every other IE, it doesn't. I have tried falling back to <code>Object.attachEvent('onload', function)</code> but I think only window has that event listener.</p>
  <p>Can anyone tell me what is the best way for this to work in every browser?</p>
  <p>EDIT</p>
  <p>I am trying this now, and it still doesn't work, both of them:</p>
  <pre><code>var script = document.createElement('script');
  script.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js';
  script.type = 'text/javascript';
  script.onload = function(){alert('jquery loaded');};
  //script.attachEvent('load', function(){alert('jquery loaded');});
  document.body.appendChild(script);
  </code></pre>