More work on the digital clock code! Kansas

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

Local Companies

Mersoft Corporation
913-871-6196
9300 W. 110th Street
Overland Park, KS
Access Group LLC
(316) 264-0270
348 Ida St.
Wichita, KS
Midwest CAM Solutions (GibbsCAM)
877-444-0982
NOW SERVING: KANSAS
Wichita, KS
Professional Software Inc
(316) 269-4264
800 E 1st St Ste 150
Wichita, KS
Allen Gibbs & Houlik L C Agh
(316) 267-7231
301 N Main St Ste 1700 Epic Center
Wichita, KS
Backup Solutions
(316) 944-4448
2707 W Douglas Ave Ste B
Wichita, KS
Brainworks Software
(316) 722-8100
7570 W 21st St N
Wichita, KS
C E M Systems Inc
(316) 264-6116
1609 E 2nd St N
Wichita, KS
Choice Solutions
(316) 293-2900
3020 N Cypress Ste 200
Wichita, KS
Vertical Solutions Inc
(316) 941-9429
2142 W Maple St
Wichita, KS

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

Mersoft Corporation

913-871-6196
9300 W. 110th Street
Overland Park, KS
www.mersoft.com

Related Local Events
Influencing without Authority
Dates: 12/3/2009 - 12/3/2009
Location: CMD Training Center WSU campus
Wichita, KS
View Details

Bio Science Committee
Dates: 6/11/2009 - 6/11/2009
Location: KCK Chamber
Kansas City, KS
View Details

Kansas Main Street Directors Quarterly Training
Dates: 5/19/2009 - 5/20/2009
Location: Downtown Vision & Finnup Center
Garden City, KS
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