More work on the digital clock code! Kirkland WA

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

Local Companies

CyberSavvy
(425) 736-3000
16625 Redmond Way,
Seattle, WA
Platinum CRM Consulting
(877) 228-7528
19125 North Creek Pkwy.,
Seattle, WA
Vertical Software Solutions
206-524-1145
3147 NE 81st St
Seattle, WA
Verizon Wireless
(206) 525-0697
5001 25th Ave.
Seattle, WA
iLink Systems
(425) 688-2988
11711 SE 8th St
Bellevue, WA
Computer Financial Services
(480) 559-1361
11226 116th Pl. NE Kirkland
Seattle, WA
Visible.net, Inc.
888-820-5383
14953 NE 95th Street
Redmond, WA
BCS
(425) 246-2011
7704 NE 148th PL
Kenmore, WA
Allied Technique, Inc.
(425) 818-0545
1317 NE 63rd St.
Seattle, WA
Essential Security Software
359-992-8926
11040 Main St
Bellevue, WA

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

Computer Financial Services

(480) 559-1361
11226 116th Pl. NE Kirkland
Seattle, WA
http://www.cfsinc.com/

Related Local Events
2010 'The Future is Now' Technology Expo
Dates: 1/27/2010 - 1/27/2010
Location: ShoWare Center
Kent, WA
View Details

Technology Thursdays: Green IT
Dates: 11/5/2009 - 11/5/2009
Location: Rainier Square Conference Center
Seattle, WA
View Details

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