我创建了一个js测验。问题存储在jquery数组中。但是,单击next将不会进入下一个数组值。如何解决这个问题?
function nextQuestion() {
submt = true;
$('#explanation').empty();
$('#question').append(quiz[currentquestion]['question']).html();
if (quiz[currentquestion].hasOwnProperty('image') && quiz[
currentquestion]['image'] != "") {
if ($('#question-image').length == 0) {
$(document.createElement('img')).addClass(
'question-image').attr('id',
'question-image').attr('name', 'anscho').attr(
'src', quiz[currentquestion]['image']).attr(
'alt', htmlEncode(quiz[currentquestion][
'question'
])).insertAfter('#question');
} else {
$('#question-image').attr('src', quiz[
currentquestion]['image']).attr('alt',
htmlEncode(quiz[currentquestion]['question'])
);
}
} else {
$('#question-image').remove();
}
addChoices(quiz[currentquestion]['choices']);
setupButtons();
}
答案 0 :(得分:0)
解决了它。感谢Johnny Mopp指出currentquestion
应该增加。感谢!!!