More work on the digital clock code! North Carolina

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

Local Companies

The Lead Tree
321-206-8283
306 North Rankin Street
Atkinson, NC
StreamLogic Inc.
704-771-1090
3030 Glen Summit Dr.
Charlotte, NC
D P Solutions Inc
336-854-7700
4411 W Market St
Greensboro, NC
Software Design Inc
336-378-0900
1301 Carolina St
Greensboro, NC
Advantec Information Systems LLC
336-275-2832
2007 Yanceyville St
Greensboro, NC
Community Web
336-499-3001
133 Hicks St
Winston-Salem, NC
BuildLinks: Web-based Project Management for Home Builders
888-700-9470
3800 Paramount Parkway, Suite 100
Morrisville, NC
Collabera
(704) 372-7272
212 South Tryon Street
Charlotte, NC
CompuData, Inc
(704) 504-0600
2401 Whitehall Park Drive
Charlotte, NC
Dalcom Consulting
336-851-1802
8 Oak Branch DR
Greensboro, NC

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

The Lead Tree

321-206-8283
306 North Rankin Street
Atkinson, NC

Regional Articles
- More work on the digital clock code! Albemarle NC
- More work on the digital clock code! Apex NC
- More work on the digital clock code! Arden NC
- More work on the digital clock code! Asheboro NC
- More work on the digital clock code! Asheville NC
- More work on the digital clock code! Bessemer City NC
- More work on the digital clock code! Boone NC
- More work on the digital clock code! Brevard NC
- More work on the digital clock code! Burlington NC
- More work on the digital clock code! Camp Lejeune NC
- More work on the digital clock code! Candler NC
- More work on the digital clock code! Cary NC
- More work on the digital clock code! Chapel Hill NC
- More work on the digital clock code! Charlotte NC
- More work on the digital clock code! Clayton NC
- More work on the digital clock code! Clemmons NC
- More work on the digital clock code! Clinton NC
- More work on the digital clock code! Concord NC
- More work on the digital clock code! Conover NC
- More work on the digital clock code! Dunn NC
- More work on the digital clock code! Durham NC
- More work on the digital clock code! Eden NC
- More work on the digital clock code! Elizabeth City NC
- More work on the digital clock code! Fayetteville NC
- More work on the digital clock code! Forest City NC
- More work on the digital clock code! Fort Bragg NC
- More work on the digital clock code! Fuquay Varina NC
- More work on the digital clock code! Garner NC
- More work on the digital clock code! Gastonia NC
- More work on the digital clock code! Goldsboro NC
- More work on the digital clock code! Granite Falls NC
- More work on the digital clock code! Greensboro NC
- More work on the digital clock code! Greenville NC
- More work on the digital clock code! Havelock NC
- More work on the digital clock code! Henderson NC
- More work on the digital clock code! Hendersonville NC
- More work on the digital clock code! Hickory NC
- More work on the digital clock code! High Point NC
- More work on the digital clock code! Hillsborough NC
- More work on the digital clock code! Hope Mills NC
- More work on the digital clock code! Huntersville NC
- More work on the digital clock code! Jacksonville NC
- More work on the digital clock code! Kannapolis NC
- More work on the digital clock code! Kernersville NC
- More work on the digital clock code! King NC
- More work on the digital clock code! Kings Mountain NC
- More work on the digital clock code! Kinston NC
- More work on the digital clock code! Knightdale NC
- More work on the digital clock code! Laurinburg NC
- More work on the digital clock code! Leland NC
- More work on the digital clock code! Lenoir NC
- More work on the digital clock code! Lexington NC
- More work on the digital clock code! Lillington NC
- More work on the digital clock code! Lincolnton NC
- More work on the digital clock code! Louisburg NC
- More work on the digital clock code! Lumberton NC
- More work on the digital clock code! Marion NC
- More work on the digital clock code! Matthews NC
- More work on the digital clock code! Mebane NC
- More work on the digital clock code! Mocksville NC
- More work on the digital clock code! Monroe NC
- More work on the digital clock code! Mooresville NC
- More work on the digital clock code! Morganton NC
- More work on the digital clock code! Mount Airy NC
- More work on the digital clock code! Mount Olive NC
- More work on the digital clock code! Murphy NC
- More work on the digital clock code! New Bern NC
- More work on the digital clock code! North Wilkesboro NC
- More work on the digital clock code! Raeford NC
- More work on the digital clock code! Raleigh NC
- More work on the digital clock code! Reidsville NC
- More work on the digital clock code! Roanoke Rapids NC
- More work on the digital clock code! Rockingham NC
- More work on the digital clock code! Rocky Mount NC
- More work on the digital clock code! Roxboro NC
- More work on the digital clock code! Rutherfordton NC
- More work on the digital clock code! Salisbury NC
- More work on the digital clock code! Sanford NC
- More work on the digital clock code! Shelby NC
- More work on the digital clock code! Siler City NC
- More work on the digital clock code! Statesville NC
- More work on the digital clock code! Tarboro NC
- More work on the digital clock code! Taylorsville NC
- More work on the digital clock code! Thomasville NC
- More work on the digital clock code! Trinity NC
- More work on the digital clock code! Wake Forest NC
- More work on the digital clock code! Waxhaw NC
- More work on the digital clock code! Waynesville NC
- More work on the digital clock code! Weaverville NC
- More work on the digital clock code! Wendell NC
- More work on the digital clock code! Whiteville NC
- More work on the digital clock code! Williamston NC
- More work on the digital clock code! Wilmington NC
- More work on the digital clock code! Wilson NC
- More work on the digital clock code! Winston Salem NC
- More work on the digital clock code! Zebulon NC
Related Local Events
Breakfast & Business (PWN)
Dates: 11/24/2009 - 11/24/2009
Location: Durham Chamber
Durham, NC
View Details

Breakfast & Business (PWN)
Dates: 11/24/2009 - 11/24/2009
Location: Durham Chamber
Durham, NC
View Details

North Carolina Legislative Holiday Reception (Govt. Affairs)
Dates: 12/3/2009 - 12/3/2009
Location: Washington Duke Inn & Golf Club
Durham, NC
View Details

North Carolina Legislative Holiday Reception (Govt. Affairs)
Dates: 12/3/2009 - 12/3/2009
Location: Washington Duke Inn & Golf Club
Durham, NC
View Details

Automation Technology Expo South
Dates: 4/28/2010 - 4/29/2010
Location: Charlotte Convention Center
Charlotte, NC
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