title: updating javascript time every second
body: <p>Basically I want to have a live clock, one that updates every second! I've looked around and couldn't find something that has worked. Here is what I have tried: </p>
  
  <pre><code>function doDate()
  {
      var str = "";
  
      var days = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
      var months = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
  
      var now = new Date();
  
      str += "Today is: " + days[now.getDay()] + ", " + now.getDate() + " " + months[now.getMonth()] + " " + now.getFullYear();
      var updateTime = function() { setTimeout("doDate()", 1000); }
  
      document.getElementById("todaysDate").innerHTML = str;
  }
  </code></pre>
  
  <p>This does not seem to work! I presume there is something I have done right in here?</p>