More work on the digital clock code! Bellefonte PA

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

Local Companies

J B & Associates
(215) 504-0500
59 Hidden Turn
Newtown, PA
Iron Cairn Consulting Inc
(724) 477-0054
Butler, PA
Oceanbridge Communications
(610) 358-4666
35 Summit Ave
Chadds Ford, PA
Panvisionary Technology
(215) 345-4069
1 Flint Cir
Doylestown, PA
Costanza & Associates
(215) 752-5115
127 Egerton Rd
Langhorne, PA
Tsr Inc
(717) 432-7360
2 Barlo Cir
Dillsburg, PA
White Donald D PA
(570) 297-4229
126 W Main St
Troy, PA
Sharp Innovations Inc
(717) 290-6760
117 S West End Ave
Lancaster, PA
Superuser Technologies Inc
(814) 362-5945
80 E Corydon St
Bradford, PA
Boyd James Assoc
(412) 833-0805
37 McMurray Rd Ste 1102
Pittsburgh, PA

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

Janis Technologies, Inc.

717-737-2935
2157 Market St.
Camp Hill, PA
http://www.janistech.com

Since 1998, Janis Technologies, Inc. has served the IT needs of small- to mid-sized organizations in a number of key industries. Our clients make use of cost-effective software solutions that considerably increase employee efficiency and improve overall company workflow. We specialize in both AccountMate and NetSuite accounting software, which allows us to provide solutions that work with your specific business processes.


The Janis Technologies team can apply the best software solutions for our clients and provide the necessary technical support to solve IT problems, from the simplest to the complex. Our highly skilled staff provides expert software installation, training, custom programming, and round-the-clock support.


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