title: JavaScript src onload
body: <p>Ok, I have this code:</p>
  
  <pre><code>&lt;script language="javascript"&gt; 
  window.onload = function(){ 
  var s = document.createElement('script'); 
  s.src = 'jscript.js'; 
  document.getElementsByTagName('body')[0].appendChild(s); 
  } &lt;/script&gt;
  
  &lt;script type="text/javascript" src="https://www.facebook.com/dragosgaftoneanu" 
  
  onload = "alert('logged in')"
  onerror="alert('not logged in)"&gt;
  
  &lt;/script&gt;
  </code></pre>
  
  <p>I want to execute the code from the first script at the onload of the second script. I have jscript.js where it is defined function().</p>