title: How to take in users name, and display it along with a message, depending on the time of day (Javascript)?
body: <p>I'm trying to display the users name, along with a message depending on what time of the day it is. I've created a function to do this, which I've called using a submit button. However, when I click submit on the webpage nothing happens?, I have put 'Name' after each message so it displays the name the users has entered into the form. What've I done wrong in the code, I'm pretty confused right now. Thanks for any help offered, I've put the code below: </p>
  
  <pre><code>&lt;div id="main"&gt;&lt;h2&gt;Type your name in here:&lt;/h2&gt;
  
  &lt;script type="text/javascript"&gt;
  function runfunction()
  {
  var Datenow = new Date();   
   (Datenow.getHours() &lt; 12 )  {     document.write("Good Morning!"); } else  
  if ( Datenow.getHours() &gt;= 12 &amp;&amp; Datenow.getHours() &lt;= 17 ) {  document.write("Good Afternoon,'Name'!"); } else   
  if ( Datenow.getHours() &gt; 17 &amp;&amp; Datenow.getHours() &lt;= 24 ) {     document.write("Good Evening,'Name'!"); } else  
  if ( Datenow.getHours() &gt; 24) { document.write("It's pretty late, 'Name', you should probably go to bed!");
  
  }
  &lt;/script&gt;
  
  &lt;form action=""&gt;
  &lt;input type="text" name="Name" size="7" value="Name" /&gt;
  
  &lt;input type="button" name="process" onclick="runfunction()" value="Submit" /&gt;
  &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>