]> git.mjollnir.org Git - moodle.git/commitdiff
Trying to fix Safari bug (NaN).
authorjulmis <julmis>
Thu, 3 Jun 2004 12:45:38 +0000 (12:45 +0000)
committerjulmis <julmis>
Thu, 3 Jun 2004 12:45:38 +0000 (12:45 +0000)
mod/quiz/jstimer.php
mod/quiz/timer.js

index 21f107919339eeafdc5d2c931b04cc1aea129d11..3d0b4585429a3eb9584a0e58bfcba96d3f1f2820 100644 (file)
@@ -10,6 +10,7 @@
 var timesup = "<?php print_string("timesup","quiz");?>";
 var quizclose = <?php echo ($quiz->timeclose - time()) - $timerstartvalue; ?>; // in seconds
 var quizTimerValue = <? echo $timerstartvalue; ?>; // in seconds
+parseInt(quizTimerValue);
 // -->
 </script>
 <script language="javascript" type="text/javascript" src="timer.js"></script>
index 91774a7e33c13b238a967aedcae3414d29e813d8..f3ddba35b2148de9330b04b6d49d9c6d143c56d1 100644 (file)
@@ -16,15 +16,18 @@ function countdown_clock() {
 
     now = quizTimerValue;
     var hours = Math.floor( now / 3600 );
+    parseInt(hours);
     now = now - (hours * 3600);
     var minutes = Math.floor(now / 60);
+    parseInt(minutes);
     now = now - (minutes * 60);
     var seconds = now;
+    parseInt(seconds);
 
     var t = "" + hours;
     t += ((minutes < 10) ? ":0" : ":") + minutes;
     t += ((seconds < 10) ? ":0" : ":") + seconds;
-    window.status = t;
+    window.status = t.toString();
 
     if(hours == 0 && minutes == 0 && seconds <= 15) {
         //go from fff0f0 to ffe0e0 to ffd0d0...ff2020, ff1010, ff0000 in 15 steps
@@ -32,7 +35,7 @@ function countdown_clock() {
         var col = 'ff' + hexascii.charAt(seconds) + '0' + hexascii.charAt(seconds) + 0;
         changecolor(col);
     }
-    document.forms['clock'].time.value = t;
+    document.forms['clock'].time.value = t.toString();
     timeout_id = setTimeout("countdown_clock()", 1000);
 }