



Return to the Javascript Playground |
Download This Page |
There are three functions which return the hours, minutes, and seconds given a time value. Another function extracts individual digits for a given value of hours, minutes, or seconds. These digits correspond to the image file name array indexes.
The IMG tags for the clock digits are named so that they can be referred to symbolically. Every 0.2 seconds (using the setTimeout function) each of the digits required to display the time is checked to see if the digit has changed. If it has, the new image is loaded.
The image style selection is a FORM with INPUT RADIO buttons all named the same so that only one can be selected. The Submit button calls a JavaScript subroutine which determines the index of the button selected. This is the same as the index of the image name array. When this index is used for the image name array, the new images are loaded.
The code for the page is extensively annotated. Please help yourself, but if you use it, we would like you to give WebSorcerer credit somehow and let us know where your site is so that we can appreciate your work.
©L. Shadoff, 1998