Jump to content

Javascript And Function Review Help!


pauldboughter

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...