<html>
<head>
<title>Live Time</title>
<script type="text/javascript">
function startTime() {
var today = new Date();
var hour = today.getHours();
var minute = today.getMinutes();
var secound = today.getSeconds();
// add a zero in front of numbers<10
minute = checkTime(minute);
secound = checkTime(secound);
document.getElementById('time').innerHTML = hour + ":" + minute + ":" + secound;
t = setTimeout('startTime()', 500);
}
function checkTime(i) {
if (i < 10) {
i = "0" + i;
}
return i;
}
</script>
</head>
<body onload="startTime()">
<p id="time"></p>
</body>
</html>