title: Cannot set property InnerHTML of null
body: <p>I've a simple html page with no code in the body tag.
  I want to insert the html in the body tag through javascript.</p>
  
  <p>My javascript file looks like this.</p>
  
  <pre><code>var Global={
      UserWall:function(){
            return "a very long html code";
     }
  };
  
      var globalObject=Object.create(Global);
     document.getElementsByTagName("body").item(0).innerHTML=globalObject.UserWall();
  </code></pre>
  
  <p>Now I want this very long html code to be auto inserted in the body tag on page load.
  But it is giving me the error I've mentioned in the title.Why?</p>
  
  <p>and also is this the correct way to create ajax based website(no page reloads) meaning that if I called server side script to update this very long html code and appended it to the body of the page.</p>