<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
function gettime() {
var date= new Date();
var hr = date.getHours();
var m = date.getMinutes();
var s = date.getSeconds();
var ampm="AM";
if (hr > 11)
{
ampm="PM"
}
if (hr > 12)
{
hr -= 12
}
if(m < 10)
{
m = "0" + m
}
if(s < 10)
{
s = "0" + s
}
document.clockform.clock.value = hr + ":" + m + ":" + s + " " +ampm;
setTimeout("gettime()",100)
}
</script>
</head>
<body onload="gettime()">
<form name="clockform">
<input type="text" name="clock">
</form>
</body>
</html>
|