Question: Marvel or DC let see! Take this questionnaire to test your knowledge! Shang-Chi Marvel DC Hawkgirl DC Marvel Thanos Marvel DC Batman DC Marvel Luke












Marvel or DC let see!


Take this questionnaire to test your knowledge!








Shang-Chi










Hawkgirl








Thanos








Batman








Luke Cage








Mr. Freeze








Hulk








Joker








Spiderman








Black Adam











Your result will show up here!




document.addEventListener("DOMContentLoaded", function() {
document.getElementById("submit").addEventListener("click", tabulateAnswers);
document.getElementById("reset").addEventListener("click", resetAnswer);
});

function tabulateAnswers() {
var choices = document.getElementsByTagName("input");
var c1score = 0;
var c2score = 0;

for (var i = 0; i < choces.length; i++) {
if (choices[i].checked) {
if (choices[i].value === 'c1') {
c1score++;
}
if (choices[i].value === 'c2') {
c2score++;
}
}
}

var maxscore = 10;
var answerbox = document.getElementById("answer");

if (c1score === maxscore) {
answerbox.innerHTML = "You are an expert the score is: " + c1score + "/" + maxscore;
}
else if (c1score < maxscore) {
answerbox.innerHTML = "You did good, but could be better!" + c1score + " " + maxscore;
}
else if (c1score === c2score) {
answerbox.innerHTML = "You got half right!";
}
else if (c1score < c2score) {
answerbox.innerHTML = "You are not completely wrong!";
}
else {
answerbox.innerHTML = "You do not like fantasy shows!";
}


}

fix the code and show count the radio buttons?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!