More work on the digital clock code! Nevada

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

Local Companies

Janalent
(888)2904870
3291 E Warm Springs Rd Ste 300
Las Vegas, NV
Rentex Inc
(800)3044819
3585 E Patrick Ln Ste 1200
Las Vegas, NV
Sparkplug
(702)5058094
3744 Civic Center Dr
N Las Vegas, NV
Check Point Software
(702) 633-7778
823 Vineyard Vine Way
North Las Vegas, NV
IT Dev, Inc.
(888)3330477
3365 E Flamingo Rd Ste 5
Henderson, NV
Intertech Computers
(702)4534433
3321 Sunrise Ave Ste 105
Las Vegas, NV
Akers & Associates, Inc.
(702)8662316
720 S 4th St Ste 305
Las Vegas, NV
Conrad & Company
(702) 699-9034
5101 Tropical Rain St
North Las Vegas, NV
P.O. Interests, Inc.
(702)8963822
2628 Langford Ave
Las Vegas, NV
RetailSystems, Inc.
(702)6170427
346 Pleasant Summit Dr
Henderson, NV

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

Janalent

(888)2904870
3291 E Warm Springs Rd Ste 300
Las Vegas, NV

Related Local Events
POWER-GEN International 2009
Dates: 12/8/2009 - 12/10/2009
Location: Las Vegas Convention Center
Las Vegas, NV
View Details

2010 7th IEEE Consumer Communications and Networking Conference (CCNC)
Dates: 1/10/2010 - 1/12/2010
Location: Harrahs Las Vegas Hotel and Casino
Las Vegas, NV
View Details

Northern Nevada Regional Business & Tech Show
Dates: 10/16/2020 - 10/16/2020
Location: .A. Nugget, Sparks
Sparks, NV
View Details

Mobile Business Expo
Dates: 11/16/2009 - 11/20/2009
Location: Mandalay Bay Resort & Casino Convention Center
Las Vegas, NV
View Details

International Telemetering Conference
Dates: 10/26/2009 - 10/29/2009
Location: Riviera Hotel & Conference Center, Las Vegas
Las Vegas, NV
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