A live clock  

The effect

You'll notice that show() is a recursive function. I have no idea how JavaScript handles stacks, but one would normally assume that this is a dangerous programming strategy.

The setTimeout() method of the window object limits the ticks to one per second (1000 milliseconds).

Code borrowed from Adding a live clock with the help of a form, in the JavaScript Kit site.

The form
<form name="Tick">
<input type="text" size="12" name="Clock">
</form>

The script
<script>
function show()
{
var Digital=new Date()
var hours=Digital.getHours()
var minutes=Digital.getMinutes()
var seconds=Digital.getSeconds()
var dn="AM" 
if (hours>12)
{
dn="PM"
hours=hours-12
//hours are written in 12-hour format
}
if (hours==0) 
  hours=12
//hours=0 (meaning 12a.m) is 12
if (minutes<=9)
  minutes="0"+minutes
if (seconds<=9)
  seconds="0"+seconds
document.Tick.Clock.value=hours+":"+minutes+":"+seconds+" "+dn
setTimeout("show()",1000)
}
show()
</script>