me Banner
TECH
HARDWARE CISCO LINUX MICROSOFT C++ HTML JAVASCRIPT PERL SHELL SCRIPTING SQL NOTES
JavaScript: Time
This code sample displays the current time. Although, it might be easier with a server side include.

<HTML>
<HEAD>
  <SCRIPT LANGUAGE="Javascript" TYPE="test/javascript">
  setInterval("settime()", 1000);

  function settime () {
  var curtime = new Date();
  var curhour = curtime.getHours();
  var curmin = curtime.getMinutes();
  var cursec = curtime.getSeconds();
  var time = "";

  if(curhour == 0) curhour = 12;
  time = (curhour > 12 ? curhour - 12 : curhour) + ":" +
  (curmin < 10 ? "0" : "") + curmin + ":" +
  (cursec < 10 ? "0" : "") + cursec + " " +
  (curhour > 12 ? "PM" : "AM");

  document.date.clock.value = time;
  }
  </SCRIPT>
</HEAD>
<BODY>

<FORM NAME="date" ACTION="">
<INPUT TYPE="text" NAME="clock" STYLE="border: 0px" value="" />
</FORM>

</BODY>
</HTML>