More work on the digital clock code! Virginia

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

Local Companies

IBM Corp
(757) 446-6200
999 Waterside DR
Norfolk, VA
Digital Image Technology Corp
(757) 623-3709
500 E Plume St
Norfolk, VA
Electronics Boutique
757-465-5977
4200 Portsmouth Blvd
Chesapeake, VA
Paramount Technology Group Inc
757-405-0110
3909 Colony Pointe DR
Chesapeake, VA
Active Computer & Electronics
757-558-8878
2981 S Military Hwy
Chesapeake, VA
Software Development & Services Corporation
703-359-1380
2200 Wilson Blvd
Arlington, VA
Geeks On Call America
(757) 722-3200
814 Kempsville Rd
Norfolk, VA
Patriot Computers
(757) 587-6400
7862 Tidewater Dr
Norfolk, VA
Direct2U Computer Repair
757-803-8126
4213 Schooner Trail
Chesapeake, VA
Torrential Data Solutions Inc
757-222-2000
5604 Virginia Beach Blvd
Virginia Beach, VA

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

IBM Corp

(757) 446-6200
999 Waterside DR
Norfolk, VA

Related Articles
- Functions in PHP Virginia
Copying the same code you need to every location you need it in is neither practical nor efficient. In the latest installment for learning PHP, you learn how to build functions as well as how to use the built-in functions provided.
- Get It To The Text Box Virginia
- The zones of the time zone clock Virginia
- What's New in JScript .NET? Virginia
- Client-side Versus Server-side Coding - Part 1 Virginia
- Perfecting the digital clock Virginia
- Create the Clock Virginia
- So You Want Interactive Form Elements, Huh? Virginia
- The Best Continuous Integration Tools Virginia
- Replace the Space With a (+) Virginia
Regional Articles
- More work on the digital clock code! Alexandria VA
- More work on the digital clock code! Annandale VA
- More work on the digital clock code! Arlington VA
- More work on the digital clock code! Ashburn VA
- More work on the digital clock code! Bassett VA
- More work on the digital clock code! Blacksburg VA
- More work on the digital clock code! Bristol VA
- More work on the digital clock code! Burke VA
- More work on the digital clock code! Centreville VA
- More work on the digital clock code! Chantilly VA
- More work on the digital clock code! Charlottesville VA
- More work on the digital clock code! Chesapeake VA
- More work on the digital clock code! Chester VA
- More work on the digital clock code! Chesterfield VA
- More work on the digital clock code! Christiansburg VA
- More work on the digital clock code! Colonial Heights VA
- More work on the digital clock code! Culpeper VA
- More work on the digital clock code! Danville VA
- More work on the digital clock code! Dumfries VA
- More work on the digital clock code! Fairfax Station VA
- More work on the digital clock code! Fairfax VA
- More work on the digital clock code! Falls Church VA
- More work on the digital clock code! Farmville VA
- More work on the digital clock code! Fredericksburg VA
- More work on the digital clock code! Front Royal VA
- More work on the digital clock code! Galax VA
- More work on the digital clock code! Glen Allen VA
- More work on the digital clock code! Hampton VA
- More work on the digital clock code! Harrisonburg VA
- More work on the digital clock code! Herndon VA
- More work on the digital clock code! Hopewell VA
- More work on the digital clock code! King George VA
- More work on the digital clock code! Leesburg VA
- More work on the digital clock code! Lorton VA
- More work on the digital clock code! Lynchburg VA
- More work on the digital clock code! Manassas VA
- More work on the digital clock code! Martinsville VA
- More work on the digital clock code! Mc Lean VA
- More work on the digital clock code! Mechanicsville VA
- More work on the digital clock code! Midlothian VA
- More work on the digital clock code! Newport News VA
- More work on the digital clock code! Norfolk VA
- More work on the digital clock code! Petersburg VA
- More work on the digital clock code! Portsmouth VA
- More work on the digital clock code! Powhatan VA
- More work on the digital clock code! Radford VA
- More work on the digital clock code! Reston VA
- More work on the digital clock code! Richmond VA
- More work on the digital clock code! Roanoke VA
- More work on the digital clock code! Salem VA
- More work on the digital clock code! Spotsylvania VA
- More work on the digital clock code! Springfield VA
- More work on the digital clock code! Stafford VA
- More work on the digital clock code! Staunton VA
- More work on the digital clock code! Sterling VA
- More work on the digital clock code! Suffolk VA
- More work on the digital clock code! Vienna VA
- More work on the digital clock code! Vinton VA
- More work on the digital clock code! Virginia Beach VA
- More work on the digital clock code! Warrenton VA
- More work on the digital clock code! Waynesboro VA
- More work on the digital clock code! Williamsburg VA
- More work on the digital clock code! Winchester VA
- More work on the digital clock code! Woodbridge VA
- More work on the digital clock code! Yorktown VA
Related Articles
- Functions in PHP Virginia
Copying the same code you need to every location you need it in is neither practical nor efficient. In the latest installment for learning PHP, you learn how to build functions as well as how to use the built-in functions provided.
- Get It To The Text Box Virginia
- The zones of the time zone clock Virginia
- What's New in JScript .NET? Virginia
- Client-side Versus Server-side Coding - Part 1 Virginia
- Perfecting the digital clock Virginia
- Create the Clock Virginia
- So You Want Interactive Form Elements, Huh? Virginia
- The Best Continuous Integration Tools Virginia
- Replace the Space With a (+) Virginia
Related Local Events
SANS Virginia Beach 2009
Dates: 8/28/2009 - 9/4/2009
Location: Sheraton Oceanfront Virginia Beach
Virginia Beach, VA
View Details

The 2009 Federal Technology Policy Forum
Dates: 7/15/2009 - 7/17/2009
Location: The Performance Institute
Arlington, VA
View Details

4th Annual Military Armor Protection
Dates: 6/23/2009 - 6/26/2009
Location: Hilton McLean
Tysons Corner, VA
View Details

Coalition Warfighter Interoperability Demonstration
Dates: 6/15/2009 - 6/26/2009
Location: Joint Systems Integration Center
Suffolk, VA
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