Jump to content

Javascript And Function Review Help!


pauldboughter
 Share

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...