One of the most fun, interesting, and educational things you can do with Java Script is to make your own image-based digital clock. The fun part is selecting or creating your own images for the digits and other graphical elements of the clock. You can use 3D digits, digits that look like baby blocks, or digits made out of animals.
Welcome to Bucaro TecHelp!

Welcome to Bucaro TecHelp!
Maintain Your Computer and Use it More Effectively
to Design a Web Site and Make Money on the Web

[About BTH]  [User Agreement]  [Privacy Policy]  [Site Map]  [Contact Form]  [Advertise on BTH]  [News Feed]

Google
Web
This Site

Make Your Own Graphical Digital Clock

Why would anyone want to make a clock to display the time on their computer when they already have one on their task bar? Because one of the most fun, interesting, and educational things you can do with Java Script is to make your own image-based digital clock.

The fun part is selecting or creating your own images for the digits and other graphical elements of the clock. You can use 3D digits, digits that look like baby blocks, or digits made out of animals. You can make your clock display the time in Bangkok, Rome, or Tokyo. You can design different cases or "skins" for your clock. You can even make your clock into an alarm clock.

In this article you'll learn about the Java Script Date object and how to use its output to select graphical digits to display the time. I'll explain everything in plain simple English and provide you with clear, easy code that you can understand and modify for your own purpose. Click Here to view the example.

Here's our plan of action to design a graphical digital clock:

1. Use Java Script to preload the digital clock's digit images. To "preload" means to cause the browser to load the images and place them in the user's browser cache so that when the webpage displays the clock will appear instantly rather than after having to wait for each digit to load.

- Of course, you'll need to select or create the digits for your clock first. For this example, I'll provide you with some basic 3D digit images.

2. Code an html <span> to contain your digit images, and enter the html code for the digits, colon, and am/pm images within the <span>.

3. Create a Java Script function, named displayTime, to display the proper clock digit images inside the <span>.

4. Set a Java Script interval timer that the displayTime function will use to call itself at regular intervals to update the time displayed by the digital clock.

5. Set the onload event of the body of the webpage to make the initial call to the displayTime function right after the webpage loads.

6. Define some style (CSS) rules to control the appearance of the clock and its digits.

7. Sit back, admire our work, and image all the cool things we can do to create even more interesting graphical digital clocks.

Web Design Sections

RSS Feed RSS Feed

Easy Java Script Code
Easy Slide Show Code
Easy Slide Show Code with Mouseover Pause
Easy Slide Show Code With Linked Slides
Slide Show with Different Size Images
Easy Java Script Timer Code
Easy Java Script Windows
Easy Rollovers
Easy Picture Transition Effects
Easy Moving Popup Code
Easy Picture Zoom Code
Easy Picture Panning Code
Easy Java Script Animation
Easy JavaScript Picture Selector Code
Easy Animated Banners with Java Script
Easy Java Script Form Validation
Easy Drag n Drop Code
Easy Graph Generating Code
Easy Code to Sort a Table by Column
Easy Expanding Menu Code
Web Designer's Reference
Object-Oriented JavaScript
Easy Fading Text Banner Code
Easy Expanding Banner Code
Calendars for Your Website
Date Picker For Your Web Site
Calculators For Your Web Site
Loan Payment Calculator
Length Units Converter
Body Mass Index
Fahrenheit to Celsius Converter
Decimal to Hexidecimal Converter
Easy Code for Screen Tape Adding Machine
Code for Java Script Circle⁄Sphere Calculator
Code for Java Script Cube⁄Box Volume Calculator
Round a Float to 4 Digits to the Right of the Decimal Point
Disable IE8 Accelerators on Your Website
Prevent Automated Form Submissions With Java Script
Make Your Own Graphical Digital Clock
Let Your Web site Visitors Set Font Size
How to Disable the Browser Back Button
Add More Bang to Your Content With Keyword Popup Menus
Put a Music Off Switch on Your Webpage
Java Script Random Password Generator
Password Protection Using the JavaScript Cookie Method
Password Protection Using the Frames Method
Replace Drop-down with Drag-and-drop
Submit Forms Without CGI
Code for a Less annoying Popup Window
Java Script Comparison Operators
Using the Java Script Array Object
Using the Java Script Date Object
Java Script Message Boxes
Java Script Trim Function
Convert Mixed Number to Decimal
How to Shuffle the Deck With Java Script
Web Site Menus : Which Section Am I In?
How Far Did the User Scroll?
Where Did the User Click?
Four Ways to Use Java Script Event Handlers
Create Your Own Database Using Only Notepad : CDV


[Site User Agreement]  [Advertise on This site]  [Search This Site]  [Contact Form]
Copyright©2001-2009 Bucaro TecHelp P.O.Box 18952 Fountain Hills, AZ 85269