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!
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started