function checkAnswers() {
    var form = document.getElementById("quiz-form");
    var answers = {
        q1: {
            answer: "block",
            text: "ブロックレベル"
        },
        q2: {
            answer: "none",
            text: "none;"
        },
        q3: {
            answer: "pt",
            text: "右上→右下→左下→左上"
        }
    };
    var score = 0;
    var resultsText = "";
    
    for (var i = 0; i < form.elements.length; i++) {
        var element = form.elements[i];
        if (element.type === "radio" && element.checked) {
            var question = element.name;
            if (answers[question].answer === element.value) {
                score++;
                resultsText += "<p>問題" +(i / 2 + 1) + ":  正解！</p>";
            } else {
                resultsText +=" <p>問題" +(i / 2 + 1) + ":  正解は" + answers[question].text + "でした。</p>";
            }
        }
    }
    
    resultsText = resultsText + "<h2> 3問中" + score + "問正解でした。</h2>";
    var resultDiv = document.getElementById("result");
    resultDiv.innerHTML = resultsText;
}