title: Multiple Defer Loading instances | Javascript
body: <p>I'm currently reading this article on Deferring the loading of Javascript:
  <a href="https://developers.google.com/speed/docs/best-practices/payload#DeferLoadingJS" rel="nofollow">https://developers.google.com/speed/docs/best-practices/payload#DeferLoadingJS</a></p>
  
  <p>They use this script:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
   // Add a script element as a child of the body
   function downloadJSAtOnload() {
   var element = document.createElement("script");
   element.src = "deferredfunctions.js";
   document.body.appendChild(element);
   }
  
   // Check for browser support of event handling capability
   if (window.addEventListener)
   window.addEventListener("load", downloadJSAtOnload, false);
   else if (window.attachEvent)
   window.attachEvent("onload", downloadJSAtOnload);
   else window.onload = downloadJSAtOnload;
  
  &lt;/script&gt;
  </code></pre>
  
  <p>I currently have <strong>4 separate Javascript files</strong> that I'd like to "defer".</p>
  
  <p>How would I achieve this using Google's example code?</p>
  
  <p>Many thanks for any pointers.</p>