HTML and CSS Reference
Figure 11-26 highlights the changes to the code.
Minutes and seconds variables added to the nYclock() function
rounds the minutes value
down to the n e arest integer
minutes left in the
seconds left in the
rounds the seconds value down to the neare st integer
6. Save your changes to the file.
7. Reopen or refresh clock.htm in your Web browser. The Web form displays the
time left in integer values of days, hours, minutes, and seconds. See Figure 11-27.
displaying the integer numbers of minutes and seconds
of minutes left
in the h o ur
of seconds left
in the minute
In some cases, the countdown value may show an extra (or missing) hour, minute, or
second. Why is that? Several factors are involved. One is the presence of daylight sav-
ing time, which moves the clock forward (or backward) one hour. If your time interval
crosses this event, the hours left value will appear off as an hour is added to or sub-
tracted from the time interval. Another factor is that the day is not evenly divided into