<html> <head>
<script type="text/javascript">
function startTime() {
var time = new Date();
function tick() {
time.setSeconds(time.getSeconds() + 1);
writeTime(time);
}
setInterval(tick, 250);
}
function writeTime(tm) {
var h=tm.getHours();
var m=tm.getMinutes();
var s=tm.getSeconds();
m=checkTime(m);
s=checkTime(s);
document.getElementById('txt').innerHTML=h+":"+m+":"+s;
}
function checkTime(i) {
if (i<10)
{
i="0" + i;
}
return i;
}
</script> </head> <body onload="startTime()"> <p id="txt"> </p> </body> </html>