More work on the digital clock code! New Hampshire

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

Local Companies

QED Connect
(603)881-3884
2 Townsend West Unit 1
Nashua, NH
Collaborative Consulting Llc
(603) 893-5327
103 Stiles Rd
Salem, NH
Mvs & Vm Consulting
(603) 529-4509
278 Colby Rd
Weare, NH
Rtm Communications
(603) 262-9100
9 Executive Park Dr
Merrimack, NH
Safety Net Solutions Inc
(603) 890-3303
Salem, NH
Key Data Systems
(603) 433-0017
24 Port Way
Rye, NH
Roma Development
(603) 228-7662
Concord, NH
Booth D
(603) 859-6120
14 Sunset Ln
New Durham, NH
Rockport Technology Group Inc
(603) 432-4613
8 Industrial Way
Salem, NH
Avantek Services
(603) 742-1333
44 Dover Point Rd
Dover, NH

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

QED Connect

SaaS provider for the mobile work force

(603)881-3884
2 Townsend West Unit 1
Nashua, NH
www.qedconnect.com

QED Connect, Inc. is an information security Software-as-a-Service (SaaS) provider that gives organizations visibility, management and control of activity on all their computers, laptops and wireless devices. The company’s popular SaaS, Omni Manager, is an affordable way to monitor and manage how employees are using company computers and the Internet at any time, from any location in the world. This solves the problems created by today’s ‘virtual’ work environment of branch offices, remote workers and traveling employees. Omni Manager is a web-hosted software application that includes e-mail and Internet filtering and blocking, antivirus, instant messaging management, asset tracking, application usage monitoring and policy management. ROI is delivered by employee productivity gains, cost savings and improved operational efficiencies.

Related Local Events
Thin Film & Crystal Growth Mechanisms 2009
Dates: 7/12/2009 - 7/17/2009
Location: Colby Sawyer College
New London, NH
View Details

Physical Organic Chemistry 2009
Dates: 6/28/2009 - 7/3/2009
Location: Holderness School
Plymouth, NH
View Details

Atomic Physics 2009
Dates: 6/28/2009 - 7/3/2009
Location: Tilton School
Tilton, NH
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