

//function to display the answers

function imaginedquizanswers(){

if (document.quiz.answer1[0].checked == true) document.quiz.a1.value=" A";

if (document.quiz.answer1[1].checked == true) document.quiz.a1.value=" B";

if (document.quiz.answer1[2].checked == true) document.quiz.a1.value=" C";

if (document.quiz.answer1[3].checked == true) document.quiz.a1.value=" D";

if (document.quiz.answer2[0].checked == true) document.quiz.a2.value=" A";

if (document.quiz.answer2[1].checked == true) document.quiz.a2.value=" B";

if (document.quiz.answer2[2].checked == true) document.quiz.a2.value=" C";

if (document.quiz.answer2[3].checked == true) document.quiz.a2.value=" D";

if (document.quiz.answer3[0].checked == true) document.quiz.a3.value=" A";

if (document.quiz.answer3[1].checked == true) document.quiz.a3.value=" B";

if (document.quiz.answer3[2].checked == true) document.quiz.a3.value=" C";

if (document.quiz.answer3[3].checked == true) document.quiz.a3.value=" D";

if (document.quiz.answer4[0].checked == true) document.quiz.a4.value=" A";

if (document.quiz.answer4[1].checked == true) document.quiz.a4.value=" B";

if (document.quiz.answer4[2].checked == true) document.quiz.a4.value=" C";

if (document.quiz.answer4[3].checked == true) document.quiz.a4.value=" D";

if (document.quiz.answer5[0].checked == true) document.quiz.a5.value=" A";

if (document.quiz.answer5[1].checked == true) document.quiz.a5.value=" B";

if (document.quiz.answer5[2].checked == true) document.quiz.a5.value=" C";

if (document.quiz.answer5[3].checked == true) document.quiz.a5.value=" D";

if (document.quiz.answer6[0].checked == true) document.quiz.a6.value=" A";

if (document.quiz.answer6[1].checked == true) document.quiz.a6.value=" B";

if (document.quiz.answer6[2].checked == true) document.quiz.a6.value=" C";

if (document.quiz.answer6[3].checked == true) document.quiz.a6.value=" D";

if (document.quiz.answer7[0].checked == true) document.quiz.a7.value=" A";

if (document.quiz.answer7[1].checked == true) document.quiz.a7.value=" B";

if (document.quiz.answer7[2].checked == true) document.quiz.a7.value=" C";

if (document.quiz.answer7[3].checked == true) document.quiz.a7.value=" D";

if (document.quiz.answer8[0].checked == true) document.quiz.a8.value=" A";

if (document.quiz.answer8[1].checked == true) document.quiz.a8.value=" B";

if (document.quiz.answer8[2].checked == true) document.quiz.a8.value=" C";

if (document.quiz.answer8[3].checked == true) document.quiz.a8.value=" D";

if (document.quiz.answer9[0].checked == true) document.quiz.a9.value=" A";

if (document.quiz.answer9[1].checked == true) document.quiz.a9.value=" B";

if (document.quiz.answer9[2].checked == true) document.quiz.a9.value=" C";

if (document.quiz.answer9[3].checked == true) document.quiz.a9.value=" D";

if (document.quiz.answer10[0].checked == true) document.quiz.a10.value=" A";

if (document.quiz.answer10[1].checked == true) document.quiz.a10.value=" B";

if (document.quiz.answer10[2].checked == true) document.quiz.a10.value=" C";

if (document.quiz.answer10[3].checked == true) document.quiz.a10.value=" D";

}

//function total the quiz answers

// assigns correct answers in array.

function total() {

var tot = 0;

//answer#[0-3] 0=A, 1=B, 2=C, 3=D

 if (document.quiz.answer1[1].checked == true) tot = 1;



 if (document.quiz.answer2[3].checked == true) tot += 1;



 if (document.quiz.answer3[2].checked == true) tot += 1;

 

 if (document.quiz.answer4[0].checked == true) tot += 1;

 

 if (document.quiz.answer5[1].checked == true) tot += 1;

 

 if (document.quiz.answer6[0].checked == true) tot += 1;

 

 if (document.quiz.answer7[2].checked == true) tot += 1;



 if (document.quiz.answer8[1].checked == true) tot += 1;

 

 if (document.quiz.answer9[3].checked == true) tot += 1;

  

 if (document.quiz.answer10[0].checked == true) tot += 1;



 if (tot==10) document.quiz.totalscore.value ="Perfect 10, congratulations";

  else document.quiz.totalscore.value = "You answered " + tot + " questions correctly.";

 }

