The Time Is:

Today Is:

JCL's Tutorial On JavaScript Time

Note : If you don't see the time and date after the whole page loads, you are not using a high enough browser. You need Netscape or Internet Explorer 2.0.2 or higher.

Creating JavaScript Time Scripts

Even though creating JavaScript time scripts may be much more time consuming than creating JavaScript prompts and alerts, time scripts tend to be fairly simple. Granted, the script may look impossible, but if you break it down, you'll see that what I say is true. To get the script, click here. Just copy and paste into your HTML document. After you have completed that task, read below for instructions and explanation. The explination is not as complete as the other tutorials because the script is way too long to break it down line by line in detailed explanation.

Breaking Down The Code

Summarizing The Script

This script is one big function which loads when the whole page is loaded and repeats itself every second (before the page has loaded, the input boxes will have the text, Loading..., in them). First, the script gets the date and time and then translates the things that should be in words from numbers to words. It also changes military time to regular time and uses the time to figure out the part of day. It then puts all this data into form boxes. Because the function is done every second, the time, date, and part of day all get updated with it. The appearance is a clock ticking away every second and the date and part of day changing when necessary.

Instructions (3 simple steps)

1. Click on the link above.
2. Copy the text on that page and paste it on to your document source.
3. Move the boxes with the time, date and day_part to the place you want them by cutting and pasting the <form name = "time_form> and </form> (and all the information in between) and moving it to the desired part in your HTML source. If you wish to seperate them into 3 different forms, change the time_form in the document.time_form (at the end of the script), for the name of the input box, to the name of the new form you are placing it in. Also, make a seperate form name to match the name after the document. (and remember </form tag> at the end of each form) for the input box which you are moving to a different form.

JCL's HTML & JavaScript Tutorial
E-Mail Me