Question: Enter the clock.html text from Figure 9.12 into a new Web page, then load the page in the browser to verify that it behaves as

Enter the clock.html text from Figure 9.12 into a new Web page, then load the page in the browser to verify that it behaves as described.

As is, your clock.html page displays a single time - the clock time when the page was loaded. Modifying this page so that it displays a dynamic, running clock is surprisingly simple. Recall from Chapter 7 that the predefined setInterval function schedules the repeated execution of a function call at regular intervals. In particular, the call

setInterval('showClock()', 1000)

Will schedule the showClock function to be called every second (1,000 milliseconds). The result is that the current time is repeatedly updated in place on the screen, in effect turning the page division into a digital clock.

Modify the ONLOAD attribute of the BODY so that it executes this call to setInterval when the page loads (instead of the single call to showClock). Verify that the resulting clock "runs" in the page?

Step by Step Solution

3.48 Rating (168 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Document Format (1 attachment)

Word file Icon

1409-C-S-O-S(1022).docx

120 KBs Word File

Students Have Also Explored These Related Operating System Questions!