More work on the digital clock code! Indiana

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

Local Companies

Bell Industries Technology Solutions Group
317-704-6000
8888 Keystone Xing
Indianapolis, IN
GT Solutions
317-844-3510
250 E 96th St
Indianapolis, IN
Peartree Software Consulting
317-257-2486
600 Holliday Ln
Indianapolis, IN
Professional Solutions
317-255-1944
2040 E 54th St
Indianapolis, IN
Sanyog Computer Solutions
317-579-0746
8650 Malaga DR
Indianapolis, IN
Seven Opals Software LLC
317-569-1810
1537 Sierra Spgs
Indianapolis, IN
Sterling Creek Software
317-567-5060
5881 E 82nd St
Indianapolis, IN
Advanced Solutions Inc
260-432-9695
7030 Pointe Inverness Way
Fort Wayne, IN
Britannia Inc
260-482-6321
1616 Directors Row
Fort Wayne, IN
CBS Computer Repair
260-441-9000
2727 Stardale Dr
Fort Wayne, IN

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

Bell Industries Technology Solutions Group

317-704-6000
8888 Keystone Xing
Indianapolis, IN

Regional Articles
- More work on the digital clock code! Anderson IN
- More work on the digital clock code! Angola IN
- More work on the digital clock code! Bedford IN
- More work on the digital clock code! Bloomington IN
- More work on the digital clock code! Brazil IN
- More work on the digital clock code! Brownsburg IN
- More work on the digital clock code! Carmel IN
- More work on the digital clock code! Chesterton IN
- More work on the digital clock code! Columbia City IN
- More work on the digital clock code! Columbus IN
- More work on the digital clock code! Connersville IN
- More work on the digital clock code! Crawfordsville IN
- More work on the digital clock code! Crown Point IN
- More work on the digital clock code! Dyer IN
- More work on the digital clock code! East Chicago IN
- More work on the digital clock code! Elkhart IN
- More work on the digital clock code! Evansville IN
- More work on the digital clock code! Fishers IN
- More work on the digital clock code! Fort Wayne IN
- More work on the digital clock code! Franklin IN
- More work on the digital clock code! Gary IN
- More work on the digital clock code! Goshen IN
- More work on the digital clock code! Granger IN
- More work on the digital clock code! Greenfield IN
- More work on the digital clock code! Greenwood IN
- More work on the digital clock code! Hammond IN
- More work on the digital clock code! Hobart IN
- More work on the digital clock code! Huntington IN
- More work on the digital clock code! Indianapolis IN
- More work on the digital clock code! Jeffersonville IN
- More work on the digital clock code! Kendallville IN
- More work on the digital clock code! Kokomo IN
- More work on the digital clock code! Lafayette IN
- More work on the digital clock code! Laporte IN
- More work on the digital clock code! Logansport IN
- More work on the digital clock code! Marion IN
- More work on the digital clock code! Martinsville IN
- More work on the digital clock code! Merrillville IN
- More work on the digital clock code! Michigan City IN
- More work on the digital clock code! Mishawaka IN
- More work on the digital clock code! Muncie IN
- More work on the digital clock code! Munster IN
- More work on the digital clock code! New Albany IN
- More work on the digital clock code! New Castle IN
- More work on the digital clock code! Newburgh IN
- More work on the digital clock code! Noblesville IN
- More work on the digital clock code! North Vernon IN
- More work on the digital clock code! Peru IN
- More work on the digital clock code! Portage IN
- More work on the digital clock code! Richmond IN
- More work on the digital clock code! Schererville IN
- More work on the digital clock code! Seymour IN
- More work on the digital clock code! Shelbyville IN
- More work on the digital clock code! South Bend IN
- More work on the digital clock code! Terre Haute IN
- More work on the digital clock code! Valparaiso IN
- More work on the digital clock code! Vincennes IN
- More work on the digital clock code! Wabash IN
- More work on the digital clock code! Warsaw IN
- More work on the digital clock code! West Lafayette IN
- More work on the digital clock code! Zionsville IN
Related Local Event
Live, Learn, & Intern - XBOX Tournament @ Aptera
Dates: 7/30/2009 - 7/30/2009
Location: Aptera Software, Inc.
Fort Wayne, IN
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