Copy the entire text BELOW THIS STATEMENT. Then replace the text in pink with your own text, while leaving the blue text intact. Save the document as "documentname.html" (e.g., months.html), and you are ready to post it on your server!
Note that the numbering of the correct answers starts with "0" (e.g., question 4). Thus, if we have five radio buttons, their numbers are 0, 1, 2, 3, 4.
Should you want to add questions, we suggest that you add them by copying question 3 and pasting the new question/s between questions 3 and 4.
 
 

<html>

<head>

<title>self evaluating quiz</title>

<script LANGUAGE="Javascript">

function gradequiz() {

var msg;

var msg_wrong;

var msg_correct;

var total_correct;

quiz = document.forms.thequiz;

total_correct = 0;

msg = "";

msg_wrong = "";

msg_correct = "";

//Question 1

if (quiz.Q1[2].checked == true) {

msg_correct += "The answer to Question 1 was correct.\n";

total_correct += 1;

}

else {

msg_wrong += "The answer to Question 1 was incorrect. Try again!\n";

}

 

//Question 2

if (quiz.Q2[3].checked == true) {

msg_correct += "The answer to Question 2 was correct.\n";

total_correct += 1;

}

else {

msg_wrong += "The answer to Question 2 was incorrect. Try again!\n";

}

 

//Question 3

if (quiz.Q3[1].checked == true) {

msg_correct += "The answer to Question 3 was correct.\n";

total_correct += 1;

}

else

{

msg_wrong += "The answer to Question 3 was incorrect. Try again!\n";

}

 

//Question 4

if (quiz.Q4[0].checked == true) {

msg_correct += "The answer to Question 4 was correct.\n";

total_correct += 1;

}

else {

msg_wrong += "The answer to Question 4 was incorrect. Try again!\n";

}

 

msg += "You answered " + total_correct + " of 4 questions correctly.\n";

msg += msg_correct + "\n";

msg += msg_wrong;

alert(msg);

return false;

}

 

function testalert () {

alert ("you selected several answers");

}

//-->

</SCRIPT>

<style type="text/css">

<!--

.frm {

line-height: 14px;

font-size: 14px;

font-family: Times, Times New Roman, serif;

}

-->

</style>

</head>

<body bgcolor=#FFFFFF>

<br>&nbsp;<br>

<form name="thequiz" class="frm">

 

<p>Select the answers to the following questions, then evaluate your answers: <o:p></o:p></p>

<p>Question 1<br>

The fifth month of the year is:<br>

<INPUT TYPE="radio" NAME="Q1" VALUE="1"

onselect="On Select">January<br>

<INPUT TYPE="radio" NAME="Q1" VALUE="2"

onselect="On Select">March<br>

<INPUT TYPE="radio" NAME="Q1" VALUE="3"

onselect="On Select">May<br>

<INPUT TYPE="radio" NAME="Q1" VALUE="4"

onselect="On Select">August<br>

<INPUT TYPE="radio" NAME="Q1" VALUE="5"

onselect="On Select">December<br

style='mso-special-character:line-break'>

<![if !supportLineBreakNewLine]><br style='mso-special-character:line-break'>

<![endif]> </p>

<p>Question 2<br>

The tenth month of the year is: <br>

<INPUT TYPE="radio" NAME="Q2" VALUE="1"

onselect="On Select">June<br>

<INPUT TYPE="radio" NAME="Q2" VALUE="2"

onselect="On Select">January<br>

<INPUT TYPE="radio" NAME="Q2" VALUE="3"

onselect="On Select">August<br>

<INPUT TYPE="radio" NAME="Q2" VALUE="4"

onselect="On Select">October<br>

<INPUT TYPE="radio" NAME="Q2" VALUE="5"

onselect="On Select">May<br

style='mso-special-character:line-break'>

<![if !supportLineBreakNewLine]><br style='mso-special-character:line-break'>

<![endif]></p>

<p>Question 3<br>

The sixth month of the year is: <br>

<INPUT TYPE="radio" NAME="Q3" VALUE="1"

onselect="On Select">January<br>

<INPUT TYPE="radio" NAME="Q3" VALUE="2"

onselect="On Select">June<br>

<INPUT TYPE="radio" NAME="Q3" VALUE="3"

onselect="On Select">March<br>

<INPUT TYPE="radio" NAME="Q3" VALUE="4"

onselect="On Select">December<br>

<INPUT TYPE="radio" NAME="Q3" VALUE="5"

onselect="On Select">February<br

style='mso-special-character:line-break'>

<![if !supportLineBreakNewLine]><br style='mso-special-character:line-break'>

<![endif]></p>

<p>Question 4<br>

The second month of the year is: <br>

<INPUT TYPE="radio" NAME="Q4" VALUE="1"

onselect="On Select">February<br>

<INPUT TYPE="radio" NAME="Q4" VALUE="2"

onselect="On Select">March<br>

<INPUT TYPE="radio" NAME="Q4" VALUE="3"

onselect="On Select">May<br>

<INPUT TYPE="radio" NAME="Q4" VALUE="4"

onselect="On Select">August<br>

<INPUT TYPE="radio" NAME="Q4" VALUE="5"

onselect="On Select">September</p>

<br>&nbsp;<br>

<input type="button" value="Evaluate Answers" onClick="gradequiz()">

</form> </body>

</html>