function startTime() { var clock=document.getElementById('clock'); r=setInterval(function(){ var time=new Date(); var h=time.getHours(); var m=time.getMinutes(); var s=time.getSeconds(); clock.innerHTML=h+":"+m+":"+s; },500); }