More work on the digital clock code! Prairie Village KS

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

Local Companies

Mersoft Corporation
913-871-6196
9300 W. 110th Street
Overland Park, KS
Cutting Edge Solutions Inc
816-421-2011
819 Walnut St
Kansas City, MO
Cutting Edge Solutions
(816) 421-2011
818 Grand Blvd Ste 900
Kansas City, MO
New Century Computer Solutions
(816) 303-0100
6601 Winchester Ave
Kansas City, MO
Beb Software Systems
816-452-4222
1806 Swift Ave
Kansas City, MO
Trabon Solutions
(816) 926-9800
420 E Bannister Rd
Kansas City, MO
Amgraf Inc
816-474-4797
1501 Oak St
Kansas City, MO
Hanmark Inc
816-472-7256
909 Walnut St
Kansas City, MO
System Solutions
(816) 472-9300
601 Walnut St
Kansas City, MO
Drafix Software
816-842-4955
114 W 3rd St
Kansas City, MO

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

Trabon Solutions

(816) 926-9800
420 E Bannister Rd
Kansas City, MO
http://www.trabonsolutions.com

Related Local Events
Girls in Science, Technology, Engineering and Mathematics: Exploring Opportunities and Opening Doors
Dates: 10/6/2009 - 10/6/2009
Location: Metropolitan Community College
Kansas City, MO
View Details

BarCampKC
Dates: 9/26/2009 - 9/26/2009
Location: JavaportKC
Kansas City, MO
View Details

Brain Food-Discover the 21st Century Virtual Office
Dates: 9/16/2009 - 9/16/2009
Location: World Trade Center Room
Kansas City, MO
View Details

Brain Food-Discover the 21st Century Virtual Office
Dates: 9/16/2009 - 9/16/2009
Location: World Trade Center Room
Kansas City, MO
View Details

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