<script>
function clock()
{
var mydate=new Date();
h=mydate.getHours();
m=mydate.getMinutes();
s=mydate.getSeconds();
if(m<10)
{
m="0"+m
}
var suffix="AM";
if(h>=12)
{
suffix="PM"
h=h-12;
}
if(h==0)
{
h=12;
}
document.getElementById("clock").innerHTML=h+":"+m+":"+s+""+suffix;
}
function setTime()
{
setInterval("clock()",1000);
}
</script>
<body bgcolor="mistyrose" onLoad="setTime()">
<h3>Digital Clock</h3>
<h1 id="clock">
</h1>
</body>
Comments 8