获取类型错误“无法读取 HTMLButtonElement.generateQuiz 处未定义的属性‘0’

时间:2021-02-17 23:40:48

标签: javascript html dom undefined typeerror

1.这是我收到唯一错误的地方,说“无法读取 HTMLButtonElement.generateQuiz 中未定义的属性‘0’。

setTime();
        var qSelect = new Question(quizQuestions[quesNum].answers, quizQuestions[quesNum].question, quizQuestions[quesNum].right);
        quesNum += 1;
        qSelect.questionOut();
    }
function resultsModalShow(x) {
    var tagNew;
    document.querySelector("#testresults").innerHTML = '';
    document.querySelector(".modal-title").innerHTML = "Test results for: " + results[x].name + ". Time left :" + results[x].time + " seconds";
    for (var i = 0; i < quizQuestions.length; i++) {
        tagNew = document.createElement("H3");
        tagNew.textContent = (i + 1) + ". Question  " + quizQuestions[i].question;
        document.querySelector("#testresults").appendChild(tagNew);
        tagNew = document.createElement("H4");
        tagNew.textContent = "Correct answer: " + quizQuestions[i].right;
        document.querySelector("#testresults").appendChild(tagNew);
        tagNew = document.createElement("H4");
        tagNew.textContent = results[x].name + "'s answer: " + results[x].quiz[i];
        if (quizQuestions[i].right != results[x].quiz[i]) {
            tagNew.style.textDecoration = "line-through";
        }
        document.querySelector("#testresults").appendChild(tagNew);
    }

0 个答案:

没有答案