我有这个测验应用程序,它会在我第一次运行它时显示结果,但是当我再次单击播放并再次运行该应用程序时,它没有显示结果。我知道我在以下代码中有问题,但无法弄清楚。请帮忙 -
//This function is for reseting the quiz
var resetQuiz = function() {
if (resetCounter++ > 1 || quizOver || confirm('Are you sure you want to reset the quiz?')) {
counter = 0;
quizOver = false;
results = {count: 0, answers: [], currentScore: 0};
scoreNode.addClass('no_score').text('');
questionBlock.show();
nextQuestion();
}
};
//This function handle the results
var showResults = function() {
answersBlock.empty();
questionBlock.hide();
showResult.text('You answered ' + results.currentScore + '% of '
+ 'the questions correctly.');
quizOver = true;
actionButton.text('Play again');
};
完整的应用程序在这里 - http://jsfiddle.net/varunksaini/J5qVd/