pauldboughter Posted February 16, 2010 Share Posted February 16, 2010 I just need someone to look at these function and see if I missed anything like a period etc. Basically check for errors.Thanks for all the previous help...<script type="text/javascript"> var seconds = 0; var clockId; function runClock() { seconds++; document.quizform.quizclock.value = "seconds"; } function startClock() { showQuiz(); var clockId = setInterval("runClock()", 1000); } function stopClock() { clearInterval("runClock()"); var correctAns = gradeQuiz(); var timer = document.quizform.quizclock.value; window.alert("You have" + correctAns + "correct of 5 in" + timer + "seconds."); } </script> Link to comment Share on other sites More sharing options...
jeffman Posted February 16, 2010 Share Posted February 16, 2010 document.quizform.quizclock.value = "seconds";remove the quotation marksvar clockId = setInterval("runClock()", 1000);remove the var keywordclearInterval("runClock()");pass clockId to clearInterval Link to comment Share on other sites More sharing options...
pauldboughter Posted February 16, 2010 Author Share Posted February 16, 2010 Thanks for the help. When you say pass the clockId to clearInterval. What exactly are you saying. Do you want me to replace the runClock with clockId? document.quizform.quizclock.value = "seconds";remove the quotation marksvar clockId = setInterval("runClock()", 1000);remove the var keywordclearInterval("runClock()");pass clockId to clearInterval Link to comment Share on other sites More sharing options...
Synook Posted February 16, 2010 Share Posted February 16, 2010 clearInterval() expects an interval. clearInterval(clockId); Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.