JavaScript for this Quiz

<SCRIPT LANGUAGE="JavaScript">
<!-- Beginning of JavaScript - 

var score = 0;
var ProblemSet = new Array(6);

function Question(index, hint, your, mine)
{
     this.index = index;
     this.hint = hint;
     this.your = your;
     this.mine = mine;
}

function GetRadioValue (Group)
{
    var value = null
    for (var Index = 0; Index < Group.length; Index++)
   {
       if (Group[Index].checked)
      {
           value = Group[Index].value
           break
       }
     }
   return value
}

function testing(i, a, b, c){
   ProblemSet[i] = new Question(i,a,b,c);
}

//Function to get score
function Score(){
     var temp = "Did I pass the exam? \n";
     for (i=1; i<=6; i++){
     temp =temp+"\nQuestion : "+i+"\n";
     if (ProblemSet[i].your == ProblemSet[i].mine){
         temp = temp+" \nYour answer is Correct! \n";
         score++;
     } 
    else{
    temp = temp+"The Correct answer is "+ProblemSet[i].mine+"\n" + ProblemSet[i].hint+"\n";
   }
}

//starts of activity 6
temp = temp+" \n\nYour total score is : "+score+"\n";
temp = temp+"\nComment : ";
if(score<=3){
temp = temp+"You FAILED!";
}
else {
temp = temp+"Congratulation, you PASSED!";
}
document.CompQuiz.Correct_Point.value = (score*4);
document.CompQuiz.Your_Grade.value = Math.round(((score * 4 * 100) / 24));
document.CompQuiz.Incorrect_Answer.value = (6 - score);

//ends of activity 6
     alert(temp);
}

//Function to validate before sending results to a new page
function ValidateAndSubmit(Form,Destination)
{
var ValidData = true;
if (GetRadioValue(Form.q1) == null)
{   ValidData = false;
     alert("You forgot to answer No. 1."); }
else if (GetRadioValue(Form.q2) == null)
{   ValidData = false;
     alert("The answer for No. 2 is simple, do you want to try?"); }
else if (GetRadioValue(Form.q3) == null)
{   ValidData = false;
     alert("No.3 is a good question, try it!."); }
else if (GetRadioValue(Form.q4) == null)
{   ValidData = false;
     alert("Opps, you forgot to pick your answer on No. 4."); }
else if (GetRadioValue(Form.q5) == null)
{   ValidData = false;
     alert("No. 5 is waiting for your selection."); }
else if (GetRadioValue(Form.q6) == null)
{   ValidData = false;
     alert("You need to answer No. 6."); }
if (ValidData)
{
     Score(); }
}

// - End of JavaScript - -->
</SCRIPT>


 Return to Previous Page