Task 6: Making the timer count up instead of down


Find the Hot Potatoes source folder, and copy the hp6timer.js_ file into your custom source folder. Open this file in your text editor. This file contains the code which makes the timer work.


First, we need to make the timer start from zero, instead of from the time limit specified in the configuration screen. Find this line:

var Seconds = [intSeconds];

Add a comment to explain your change:

//MDH_Custom: set the timer to start from zero

Notice that this comment begins with two slashes; that's how you make a line into a comment in JavaScript.


Next, make another copy of the line of code, so you have two copies. Comment out the first one, then modify the second, so you have this:

//var Seconds = [intSeconds];
var Seconds = 1;

Now you can see what the line used to be, and what it is now.


Next, we need to make the timer count upwards instead of downwards. Find this line:


And change it to this:

//MDH_Custom: made the timer count upwards instead of downwards.


Now make a little JQuiz exercise to test with. Remember to include a timer. It doesn't matter what time limit you set, though; the time limit will not be used. Here's an example.