More work on the digital clock code! Alvin TX

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

Local Companies

Hydrocarbon Data Systems Inc
(713) 690-0556
13831 Northwest Fwy
Houston, TX
Southeastern Computer Consultants Inc
(512) 794-0033
5332 Thunder Creek Rd
Austin, TX
Rockland Technology Group
(972) 219-0911
817 S Mill St
Lewisville, TX
Wylie West Executive Suites
(972) 429-8200
2610 W Fm 544
Wylie, TX
Intergon
(713) 771-1073
5800 Ranchester Dr
Houston, TX
Netsync Network Solutions
(713) 664-9970
2500 West Loop S
Houston, TX
Iona Technologies
(972) 361-8188
15950 Dallas Pkwy
Dallas, TX
Coopera Tech
(713) 965-0505
1 E Greenway Plz Ste 400
Houston, TX
Effective Resources Ltd
(210) 930-1166
San Antonio, TX
Th Enterprises Inc
(972) 226-9311
310 E I-30 Fwy
Sunnyvale, TX

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

Entrance Software

713-357-4930
1001 McKinney
Houston, TX
http://www.entrancesoftware.com

For mid-sized businesses that own or need software, Entrance Software is a Trusted Advisor. Unlike other contract programming or staffing companies, Entrance exclusively provides Professional Software Consultants who are not only technical geniuses, but also understand the business value of Sales, Profit, Productivity, Loyalty and Morale.

Entrance Software is a Microsoft Gold Certified Partner and develops custom software applications for businesses in a variety of industries including Oil and Gas, Exploration and Production, Manufacturing, Education, Legal and Medical Services.


Related Articles
- Functions in PHP Alvin TX
Copying the same code you need to every location you need it in is neither practical nor efficient. In the latest installment for learning PHP, you learn how to build functions as well as how to use the built-in functions provided.
- Client-side Versus Server-side Coding - Part 1 Alvin TX
- Replace the Space With a (+) Alvin TX
- Perfecting the digital clock Alvin TX
- The Best Continuous Integration Tools Alvin TX
- What's New in JScript .NET? Alvin TX
- So You Want Interactive Form Elements, Huh? Alvin TX
- Create the Clock Alvin TX
- Get It To The Text Box Alvin TX
- The zones of the time zone clock Alvin TX
Related Articles
- Functions in PHP Alvin TX
Copying the same code you need to every location you need it in is neither practical nor efficient. In the latest installment for learning PHP, you learn how to build functions as well as how to use the built-in functions provided.
- Client-side Versus Server-side Coding - Part 1 Alvin TX
- Replace the Space With a (+) Alvin TX
- Perfecting the digital clock Alvin TX
- The Best Continuous Integration Tools Alvin TX
- What's New in JScript .NET? Alvin TX
- So You Want Interactive Form Elements, Huh? Alvin TX
- Create the Clock Alvin TX
- Get It To The Text Box Alvin TX
- The zones of the time zone clock Alvin TX
Related Local Events
Subsea Tieback Exhibition (SSTB)
Dates: 3/2/2010 - 3/4/2010
Location: Moody Gardens Hotel & Convention Center
Galveston, TX
View Details

Deep Offshore Technology (DOT 2010)
Dates: 2/2/2010 - 2/4/2010
Location: George R. Brown Convention Center
Houston, TX
View Details

2009 IEEE Industry Applications Society Annual Meeting
Dates: 10/4/2009 - 10/7/2009
Location: Hyatt Regency Houston
Houston, TX
View Details

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