javascript clock trouble running timer function?
<p>Was wondering where I am going wrong with this snippet of code, basically the startTime() only gets run once and thats it so the clock doesnt update. Can anyone advise how I can fix this?</p>

<p>JS</p>

<pre><code>function startTime(){
  var today=new Date();
  var h=today.getHours();
  var m=today.getMinutes();
  var s=today.getSeconds();
  // add a zero in front of numbers&lt;10
  m=checkTime(m);
  s=checkTime(s);
  document.getElementById('txt').innerHTML=h+":"+m+":"+s;
  t=setTimeout('startTime()',500);
  }

  function checkTime(i){
  if (i&lt;10)
    {
    i="0" + i;
    }
  return i;
  }
</code></pre>

<p>HTML</p>

<pre><code>    &lt;body onload="startTime()"&gt;

&lt;p&gt;Date&lt;/p&gt;
&lt;?php echo date("d/m/y"); ?&gt;

&lt;p&gt;Time&lt;/p&gt;
&lt;div id="txt"&gt;&lt;/div&gt;
</code></pre>

<p>Link <a href="http://bit.ly/IC9ohX" rel="nofollow">http://bit.ly/IC9ohX</a></p>
