title: Enter date into HTML onload Javascript
body: <p>I am trying to enter the current date when the page loads. I am able to store it to a variable, I am just having trouble entering that variable onto the page.</p>
  
  <p>HTML: </p>
  
  <pre><code>&lt;span id='test'&gt;x&lt;/span&gt;
  </code></pre>
  
  <p>Javascript: </p>
  
  <pre><code>window.onload = function() {
    var month = new Array("January", "February", "March", "April", "May", "June", "July",    "August", "September", "October", "November", "December");
    var today = new Date();
    var dd = today.getDate();
    var mm = today.getMonth();
    var currentMonth = month[mm];
    var yyyy = today.getFullYear();
    today = currentMonth + ' ' + dd + ', ' + yyyy;
    document.getElementById('test').innertext() = today;
  }
  </code></pre>
  
  <p><a href="http://jsfiddle.net/8DeXF/1/" rel="nofollow">JSFIDDLE</a></p>