Tuesday 4 November 2014

Live Digital Clock - Javascript 0

Here is the code for Live digital clock.

Just we are going write a function to get the current time and display it in span. We are calling that function for each 1000 milli seconds. so, live clock is working.

var int=self.setInterval("clock()",1000);
function clock(){
var now=new Date();
var time=now.toLocaleTimeString();
document.getElementById("clock").textContent=time;
};
 Here is the live Demo

Thanks Christian White