Ok guys I’m trying to pass a JavaScript variable being score in this case from the first function to the second.
After that I would like to *pass the variable to another html page to display the results of the quiz.
Any suggestions are appreciated thank you.
[code]
Questions.prototype.ScoreIt = function() { *var score = this.AreQuestionsAnswered(); if (score > 0) { alert(“You have left ” + score + ” questions unanswered. Please try again.”); document.getElementById(“submit”).disabled = false; score = 0; } else { for (var Ix=0; Ix<10; Ix++) { if (this.Answer[Ix] == this.thisAns[Ix]) { document.getElementById(“check” + Ix).checked = true;
score++;
//Ix = Ix+1
//alert(“you got question # ” + Ix + ” correct”); } else { document.getElementById(“check” + Ix).checked = false; } //end else } document.getElementById(“submit”).disabled = true; var buttonToShow = document.getElementById(“invisiButton”);
buttonToShow.style.visibility = “visible”; var buttonToShow = document.getElementById(“invisiButtona”);
buttonToShow.style.visibility = “visible”; var buttonToShow = document.getElementById(“invisiButtonb”);
buttonToShow.style.visibility = “visible”;
alert(“You got ” + score + ” correct.”); alert(“Questions with check marks are correct.n * * *Please click the review button n * * * * * for more information.”);
}
}
//review the results
Questions.prototype.review = function() { alert (“The number you got right was ” + score + ” out of 10.”); }