More work on the digital clock code! Guilford CT

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

Local Companies

R & W Associates
(203) 453-1627
40 Stillmeadow Dr
Guilford, CT
Prime Business Services
(203) 453-1627
40 Stillmeadow Dr
Guilford, CT
Vandertech
(203) 458-8299
725 Boston Post Rd
Guilford, CT
Tarleton Ltd
(203) 975-0832
214 Westwood Rd
Stamford, CT
Positive Energy
(860) 210-0010
3 Twin Brooks Rd
New Milford, CT
OFFiS Corporation
203-265-6700
61 N Plains Industrial Rd
Wallingford, CT
McData Corporation
(203) 458-0686
Guilford, CT
Catapult
(203) 453-1627
40 Stillmeadow Dr
Guilford, CT
Accent On Computers Llc
(203) 625-7575
Greenwich, CT
Unisys Corporation
(203) 926-2800
4 Corporate Dr
Shelton, CT

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

OFFiS Corporation

203-265-6700
61 N Plains Industrial Rd
Wallingford, CT
http://offis.net

Related Local Events
NET Series: Lunch Bunch
Dates: 1/5/2010 - 1/5/2010
Location: Maneeley's Banquet Facility & Catering
South Windsor, CT
View Details

The New Balancing Act
Dates: 11/5/2009 - 11/5/2009
Location: Acton Public Library
Old Saybrook, CT
View Details

The New Balancing Act
Dates: 11/3/2009 - 11/3/2009
Location: Estuary Council of Seniors
Old Saybrook, CT
View Details

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