<html>
<head></head>

<body bgcolor="#FFFFFF" link="#0000FF" vlink="#000080" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" OnLoad="SiteDesignerPageLoadHook()" alink="#808080">

<form>
 <table border=0 cellpadding=0 cellspacing=0>
  <tr height=0>
   <td width=710></td>
   <td width=91></td>
  </tr>

 <tr height=24>
  <td width=710 height=24></td>
  <td colspan=1 rowspan=1 height=24 valign=top align=left>

  <!-- Clock.DigitalClock ELEMENT (10000) START ------>

  <table border=0 cellpadding=0 cellspacing=0><tr width=91 height=24>
    <td width=91 height=24 valign=top>
     <input type=text name="time0" size=11>
    </td>
 </tr>
  </table>
 </td>
</tr>
</table>
</form>
</body>

<script language="JavaScript">

<!--
function SiteDesignerPageLoadHook(){
UpdateClock0();

}
// ------>

</script>


<script language="JavaScript">
<!--

var ID0=0;
var sep0=":";

function UpdateClock0() {
   var d = new Date();
   var h = d.getHours();
   var m = d.getMinutes();
   var s = d.getSeconds();

   if (s<10)s="0"+s;
   if (m<10)m="0"+m;

   var suffix="";
   var prefix="";

   if (h<=12)suffix=" am";
   else suffix=" pm";

   if (h>=13)h=h-12;

   if (sep0==" ")sep0=":";
   else sep0=" ";

   if(ID0)clearTimeout(ID0);
   document.forms[0].time0.value = prefix + h + sep0 + m + sep0 + s + suffix;
   ID0 = setTimeout("UpdateClock0()", 1000);
}
//------>

</script>
</html>
Published in: JavaScript
Download

Related snippets