The script gets the initial day and time from your computer. Then it uses setTimeout to create a timing event that update the text in your div every 1/2 a second. The DIV tag does not matter; as long as whatever element you want to display the time in; has an id of txt and the element is capable of displaying content in it; then you could use any element.
you could just do something like this:
<script type="text/javascript">
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<10
m=checkTime(m);
s=checkTime(s);
document.getElementById('txt').innerHTML=h+":"+m+":"+s;
t=setTimeout('startTime()',500);
}
function checkTime(i)
{
if (i<10)
{
i="0" + i;
}
return i;
}
</script>
</head>
<body onload="startTime()">
<table>
<tr>
<td id="txt"></td>
</tr>
</table>
or if you don't want to take up any space at all in your page; I suggest using a span, like so:
<span id="txt"></span>