More work on the digital clock code! Arizona

Today we begin playing around with replacing those image tags with the correct numbers, depending on what time it is.

Local Companies

JDR Consulting
480-491-4756
1660 S. Alma School Rd. Ste 223
Mesa, AZ
Aya Solutions
480-833-1727
1955 E Hackamore St
Mesa, AZ
Multi Edit Software Inc
480-610-2700
7532 E Dulciana Cir
Mesa, AZ
Alphasource Technologies Inc Inc
520-620-6888
3120 W Corte Olivia
Tucson, AZ
Component Software Inc
480-496-9303
5831 W Kesler St
Chandler, AZ
Synapps LLC
(480) 664-6071
4649 E Carriage Ct
Gilbert, AZ
Vertex Inc
(480) 283-8600
2961 E Marlene Dr
Gilbert, AZ
Wizard Computer Services
(480) 926-3144
2104 E Freeport Ln
Gilbert, AZ
Lone Wolf Software Inc.
(623) 824-1140
6097 N 57th Drive
Glendale, AZ
BBB Systems, LLC
(602) 424-0914
2340 W. Mission
Phoenix, AZ

provided by: 
Originally published at Internet.com


Tips...

Last week we learned the NAMEs attached to each of the HTML image tags. Today we begin playing around with replacing those image tags with the correct numbers, depending on what time it is.

Here's the code

The time is grabbed from the user's browser, so there's no need to worry about daylight savings time or time zones. As long as the viewer has his or her browser set correctly, you're good to go. If they don't, well, you can't help that.

Let's start at the top of the script just below the loading loop and code: function clock() { dates=new Date(); hour=dates.getHours(); min=dates.getMinutes(); sec=dates.getSeconds(); if(hour < 12) { amPM=am.src; } if(hour > 11) { amPM=pm.src; hour=hour-12; } if(hour == 0) { hour=12; } if(hour < 10) { document["tensHour"].src="http://www.developer.com/dgtbl.gif"; document["Hour"].src=d[hour].src; } if(hour > 9) { document["tensHour"].src=d[1].src; document["Hour"].src=d[hour-10].src; } if(min < 10) { document["tensMin"].src=d[0].src; } if(min > 9) { document["tensMin"].src=d[parseInt(min/10,10)].src; } document["Min"].src=d[min%10].src; if(sec < 10) { document["tensSec"].src=d[0].src; } if(sec > 9) { document["tensSec"].src=d[parseInt(sec/10,10)].src; } document["Sec"].src=d[sec%10].src; document["amPM"].src=amPM; setTimeout("clock();",100); } ...

Read article at Internet.com site

Featured Local Company

JDR Consulting

480-491-4756
1660 S. Alma School Rd. Ste 223
Mesa, AZ
http://www.jdrconsulting.com

Related Articles
- Functions in PHP Arizona
Copying the same code you need to every location you need it in is neither practical nor efficient. In the latest installment for learning PHP, you learn how to build functions as well as how to use the built-in functions provided.
- Perfecting the digital clock Arizona
- Client-side Versus Server-side Coding - Part 1 Arizona
- Create the Clock Arizona
- Replace the Space With a (+) Arizona
- The zones of the time zone clock Arizona
- So You Want Interactive Form Elements, Huh? Arizona
- The Best Continuous Integration Tools Arizona
- Get It To The Text Box Arizona
- What's New in JScript .NET? Arizona
Regional Articles
- More work on the digital clock code! Apache Junction AZ
- More work on the digital clock code! Avondale AZ
- More work on the digital clock code! Buckeye AZ
- More work on the digital clock code! Bullhead City AZ
- More work on the digital clock code! Casa Grande AZ
- More work on the digital clock code! Cave Creek AZ
- More work on the digital clock code! Chandler AZ
- More work on the digital clock code! Cottonwood AZ
- More work on the digital clock code! Flagstaff AZ
- More work on the digital clock code! Fountain Hills AZ
- More work on the digital clock code! Gilbert AZ
- More work on the digital clock code! Glendale AZ
- More work on the digital clock code! Goodyear AZ
- More work on the digital clock code! Green Valley AZ
- More work on the digital clock code! Kingman AZ
- More work on the digital clock code! Lake Havasu City AZ
- More work on the digital clock code! Mesa AZ
- More work on the digital clock code! Paradise Valley AZ
- More work on the digital clock code! Peoria AZ
- More work on the digital clock code! Phoenix AZ
- More work on the digital clock code! Prescott AZ
- More work on the digital clock code! Prescott Valley AZ
- More work on the digital clock code! Safford AZ
- More work on the digital clock code! Scottsdale AZ
- More work on the digital clock code! Sedona AZ
- More work on the digital clock code! Sierra Vista AZ
- More work on the digital clock code! Somerton AZ
- More work on the digital clock code! Sun City AZ
- More work on the digital clock code! Sun City West AZ
- More work on the digital clock code! Surprise AZ
- More work on the digital clock code! Tempe AZ
- More work on the digital clock code! Tucson AZ
- More work on the digital clock code! Yuma AZ
Related Articles
- Functions in PHP Arizona
Copying the same code you need to every location you need it in is neither practical nor efficient. In the latest installment for learning PHP, you learn how to build functions as well as how to use the built-in functions provided.
- Perfecting the digital clock Arizona
- Client-side Versus Server-side Coding - Part 1 Arizona
- Create the Clock Arizona
- Replace the Space With a (+) Arizona
- The zones of the time zone clock Arizona
- So You Want Interactive Form Elements, Huh? Arizona
- The Best Continuous Integration Tools Arizona
- Get It To The Text Box Arizona
- What's New in JScript .NET? Arizona
Related Local Events
Toastmasters
Dates: 11/26/2009 - 11/26/2009
Location: Peoria Chamber of Commerce
Peoria, AZ
View Details

The Big Draw VI
Dates: 12/1/2009 - 12/1/2009
Location: The Crown Room
Scottsdale, AZ
View Details

Toastmasters
Dates: 1/7/2010 - 1/7/2010
Location: Peoria Chamber of Commerce
Peoria, AZ
View Details

Toastmasters
Dates: 2/4/2010 - 2/4/2010
Location: Peoria Chamber of Commerce
Peoria, AZ
View Details

Toastmasters
Dates: 3/25/2010 - 3/25/2010
Location: Peoria Chamber of Commerce
Peoria, AZ
View Details

Rss   Delicious   Digg   Add To My Yahoo   Add To My Google   Bookmark   Search Plugin

Topics:
Architecture & Design Languages & Tools Project Management Web Services
Database Microsoft & .NET Security Wireless
Java Open Source Techniques XML