More work on the digital clock code! Haughton LA

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

Local Companies

Acetech
(504) 822-3456
2714 Canal St Ste 300
New Orleans, LA
Computer Power Technology
(337) 232-7893
Lafayette, LA
Emaxim Lc
(225) 755-0400
9865 Pecue Ln
Baton Rouge, LA
Professional Publications
(225) 346-0707
Baton Rouge, LA
Sei Consultants
(985) 781-1015
429 South St
Slidell, LA
Methods Technology Solutions Inc
(225) 201-0992
4734 Jamestown Ave
Baton Rouge, LA
Miller Cad Consultants
(985) 871-7990
63 Walnut Pl
Covington, LA
Dot21 Real-Time Systems Inc
(504) 833-3560
3350 Ridgelake Dr
Metairie, LA
Slvtec Consultants
(985) 845-9954
Madisonville, LA
Design Plus Llc
(337) 942-7020
204 E Madison St
Opelousas, LA

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

Xidisk Software Solutions

903-838-2560
7307 Palisades Dr
Texarkana, TX
http://www.xidisk.com

Xidisk is a full service technology solutions company located in Texarkana Texas. We specialize in providing custom software and website development. With over fourteen years of Microsoft products experience, Xidisk is committed to producing tangible results. Our goal is to help clients leverage technology solutions in order to reduce overall costs and gain a competitive edge in the marketplace.


Topics: 
Architecture & Design Languages & Tools Project Management Web Services
Database Microsoft & .NET Security Wireless
Java Open Source Techniques XML