HTML Tutorial
JavaScripts
Alert
Opening and Closing Windows
Getting and Displaying Text from User
Displaying Date
Moving Through History
Status Bar Clock
Title Bar Clock
Clock
Scrolling Status Bar Message
Typing Status Bar Message
Bouncing Status Bar Message
Title Bar Message Changer
Title Bar Message Typer
Javascript Tutorial

Instructions: Paste this script in your HTML document where you wish the clock to appear. Make sure the textbox is before the script itself. If you do not want to display the seconds, remove the blue line.

Tested On: IE 6, Mozilla 1.3, Opera 7

<FORM NAME = "clockForm">
  <INPUT TYPE="text" NAME = "clock" SIZE = "10">
</FORM>

<SCRIPT LANGUAGE="JavaScript">
  <!-- Hide this from older browsers
  // This script was written by Protoplasm
  // http://geocities.datacellar.net/protoplasm72

  function display() {
    var Today = new Date();
    var hours = Today.getHours();
    var min = Today.getMinutes();
    var sec = Today.getSeconds();
    var Time = ((hours > 12) ? hours - 12 :(hours == 0) ? 12 :hours);
    Time += ((min < 10) ? ":0" : ":") + min;
    Time += ((sec < 10) ? ":0" : ":") + sec;
    Time += (hours >= 12) ? " PM" : " AM";
    clock.title = Time;
    setTimeout("display()",1000);
  }

  display();

  // end hide -->
</SCRIPT>

Written by Protoplasm

1