HTML and CSS Reference
In-Depth Information
You'll write the code to start and stop the quiz timer as well as to call the functions
that show and grade a completed quiz. Figure 11-38 shows a preview of the exam page
in action.
Figure 11-38
Movie trivia page
Complete the following:
1. Use your text editor to open the triviatxt.htm file from the tutorial.11\case1 folder,
enter your name and the date in the head section, and then save the file as trivia.htm
in the same folder.
2. Above the closing </head> tag, insert an external script element that points to the
functions.js file in the tutorial.11\case1 folder.
3. Below this script element, insert another script element. Within the script ele-
ment, declare two variables. The first variable, seconds , will be used later to store
the current elapsed time that the user has worked on the exam. The second variable,
clockId , will be used later to reference the commands repeatedly run to update the
clock value. Set the initial value of the seconds variable to 0 . Do not set an initial
value for the clockId variable.
4. Create a function named runClock() that will update the time value in the Web
page's clock. There are no parameters. Add the following commands to the function:
a. Use a unary operator to increase the value of the seconds variable by 1.
b. Change the value of the quizclock field in the quiz form to the value of the
seconds variable.
 
Search WWH ::




Custom Search