More work on the digital clock code! Oregon

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

Local Companies

Central Telephone
509-773-4472
1505 S. Grant
Goldendale, OR
Gorge Networks
541-386-8300
616 Industrial Way
Hood River, OR
Embarq
1-800-877-1125
902 Wasco
Hood River, OR
Advantyx Software LLC
503-246-9299
6501 SW Macadam Ave
Portland, OR
Vision33
971-255-0162
The Lincoln Center, 10260 SW Greenburg Road, 4th Floor
Portland, OR
Artisan Software Tools Inc
503-245-6200
10220 SW Greenburg Rd
Portland, OR
Axis Clinical Software Inc
503-292-3022
6443 SW Beaverton Hillsdale Hwy
Portland, OR
Cendix
503.789.2676
501 4th Street, Suite 741
Lake Oswego, OR
Cascade Custom Software
503-922-0135
1000 SW Broadway
Portland, OR
Aravo Solutions
503-224-4049
2627 NW Nicolai St
Portland, OR

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

Central Telephone

509-773-4472
1505 S. Grant
Goldendale, OR

Regional Articles
- More work on the digital clock code! Albany OR
- More work on the digital clock code! Beaverton OR
- More work on the digital clock code! Bend OR
- More work on the digital clock code! Canby OR
- More work on the digital clock code! Central Point OR
- More work on the digital clock code! Clackamas OR
- More work on the digital clock code! Coos Bay OR
- More work on the digital clock code! Corvallis OR
- More work on the digital clock code! Eugene OR
- More work on the digital clock code! Forest Grove OR
- More work on the digital clock code! Grants Pass OR
- More work on the digital clock code! Gresham OR
- More work on the digital clock code! Hermiston OR
- More work on the digital clock code! Hillsboro OR
- More work on the digital clock code! Hood River OR
- More work on the digital clock code! Klamath Falls OR
- More work on the digital clock code! La Grande OR
- More work on the digital clock code! Lake Oswego OR
- More work on the digital clock code! Lebanon OR
- More work on the digital clock code! Mcminnville OR
- More work on the digital clock code! Medford OR
- More work on the digital clock code! Newberg OR
- More work on the digital clock code! North Bend OR
- More work on the digital clock code! Oregon City OR
- More work on the digital clock code! Pendleton OR
- More work on the digital clock code! Portland OR
- More work on the digital clock code! Prineville OR
- More work on the digital clock code! Roseburg OR
- More work on the digital clock code! Salem OR
- More work on the digital clock code! Springfield OR
- More work on the digital clock code! The Dalles OR
- More work on the digital clock code! Troutdale OR
- More work on the digital clock code! Tualatin OR
- More work on the digital clock code! West Linn OR
- More work on the digital clock code! Wilsonville OR
- More work on the digital clock code! Woodburn OR
Related Local Events
WOOD TECHNOLOGY CLINIC & SHOW 2010
Dates: 3/9/2010 - 3/11/2010
Location: Oregon Convention Center
Portland, OR
View Details

Party in the Pinot
Dates: 7/25/2009 - 7/25/2009
Location: Oswego Hills Winery
West Linn, OR
View Details

WebVisions 2009
Dates: 5/20/2009 - 5/22/2009
Location: Oregon Convention Center
Portland, OR
View Details

Technology and IP Networking Event
Dates: 5/19/2009 - 5/19/2009
Location: Oregon Zoo
Portland, OR
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