title: Javascript Auto run a function
body: <p>I want my function "thing()" to run automatically from the page load. At the moment it is activated by a button.</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;button onclick="thing()"&gt;Greeting&lt;/button&gt;
  </code></pre>
  
  <p><strong>Javascript</strong></p>
  
  <pre><code>function thing() {
    var greeting;
    var time = new Date().getHours();
    if (time &lt; 10) {
      greeting = "Good morning";
    } else if (time &lt; 20) {
      greeting = "Good day";
    } else {
      greeting = "Good Evening";
    }
    document.getElementById("address").innerHTML = greeting;
  }
  </code></pre>
  
  <p>I am very new to java script so as simply please.</p>