Perfecting the digital clock Cedar Falls IA

We're in the home stretch with the digital clock script. All we need to do now is set the minutes and seconds.

Local Companies

Joe's Computer Consulting Service
(712) 469-2279
1710 Main St
Manson, IA
Techcentral
(515) 727-5400
7177 Hickman Rd
Urbandale, IA
Talentlink
(515) 282-4784
2600 Grand Ave Ste 216
Des Moines, IA
Phantom Realty
(515) 224-4045
1200 35th St
West Des Moines, IA
Silicon Plains Technologies
(515) 225-8700
8530 New York Ave
Urbandale, IA
Palmer Consulting
(515) 226-9900
3737 Woodland Ave Ste 300
West Des Moines, IA
Jacobsen Holz Corp
(515) 465-3567
1224 Pattee St
Perry, IA
Systems Support Inc
(515) 225-7337
1601 48th St Ste 130
West Des Moines, IA
Tss Group
(319) 373-5869
7500 Hampshire Dr NE
Cedar Rapids, IA
F 1 Computer Services
(319) 545-1511
Tiffin, IA

provided by: 
Originally published at Internet.com


Tips... We're in the home stretch. We've grabbed the time, set the returns into numbers we can play with and used those numbers to post the AM/PM image and the two hour images. Now we'll set the minutes and seconds.

Here's the code

Here's the code we're interested in:

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);

The script plays with the minutes and seconds in the same way it did the hours, through "if" statements.

If the minute return is less than "tensMIN" (the first minute image), it is set to d0.src. If you look back up the script, you'll see that is the dgt0.gif.

If the minute is more than nine, then we need to get the correct 10 number in the "tensMin" position. We already know that the minute return is 10 or above so we need either 1, 2, 3, 4, or 5. The little math equation parseInt(min/10,10) does the trick...

Read article at Internet.com site
Related Articles
Related Articles

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