gogirl
11-28-2002, 01:59 PM
Here's my code! I need help! I can't get the quiz to score when you click on the score button. CAN ANYONE HELP ME BY MONDAY DEC 2ND? The error codes say ( line 15 expected ; this is line 15--Var answers = newArray(3);) and (line 66 object expected--this is line 66--<p><INPUT TYPE="button" VALUE="Score Quiz" onClick="scoreQuiz1();"></p>)--I'm stumped! I will be eternally grateful for help.
<html>
<HEAD>
<TITLE>Car Quiz</TITLE>
<A HREF="much ado.html">Return Home</a>
<BR>
<BR>
<IMG SRC="TRAILBLAZER.BMP" ALIGN=RIGHT>
<BR>
<BR>
</head>
<SCRIPT LANGUAGE="JavaScript">
<!-- HIDE FROM INCOMPATIBLE BROWSERS
Var answers = newArray(3);
var correctAnswers = newArray(3);
correctAnswers[0] = "a";
correctAnswers[1] = "a";
correctAnswers[2] = "a";
function recordAnswer(question, answer) {
answers[question-1] = answer;
}
function scoreQuiz1() {
var totalCorrect = 0;
for (var count = 0; count < correctAnswers.length;++count){
if (answers[count] == correctAnswers[count]) ++totalCorrect;
}
alert("You scored " + totalCorrect + " out of 3 answers correctly!");
}
//stop hiding from incompatible browsers-->
</SCRIPT>
<body bgcolor="EOEOEO">
<center><H3>Take this quiz!</h3></center>
<p>Answer the following questions then click the "Score Quiz" button to grade your quiz.</p>
<form>
<p><B>1.A Durango is....?</b></p>
<p><input type=radio name=question1 VALUE="a"
onClick score="recordAnswer(1, this.value)">a SUV<br>
<input type=radio name=question1 value="b"
onClick score="recordAnswer(1, this.value)">a camper<br>
<input type=radio name=question1 value="c"
onClick score="recordAnswer(1, this.value)">an all terrain vehicle<br></P>
<p><B>2. A 300M is...?</b></p>
<p><input type=radio name=question2 value="a"
onClick score="recordAnswer(2, this.value)">a Luxury car<br>
<input type=radio name=question2 value="b"
onClick score="recordAnswer(2, this.value)">a SUV<br>
<input type=radio name=question2 value="c"
onClick score="recordAnswer(2, this.value)">an all terrain vehicle<br></P>
<p><B>3.A Jeep can be...</b></p>
<p><input type=radio name=question3 value="a"
onClick score="recordAnswer(3, this.value)">any color<br>
<input type=radio name=question3 value="b"
onClick score="recordAnswer(3, this.value)">Red<br>
<input type=radio name=question3 value="c"
onClick score="recordAnswer(3, this.value)">Green<br></P>
<br>
<p><INPUT TYPE="button" VALUE="Score Quiz" onClick="scoreQuiz1();"></p>
</form>
</body>
</html>
<html>
<HEAD>
<TITLE>Car Quiz</TITLE>
<A HREF="much ado.html">Return Home</a>
<BR>
<BR>
<IMG SRC="TRAILBLAZER.BMP" ALIGN=RIGHT>
<BR>
<BR>
</head>
<SCRIPT LANGUAGE="JavaScript">
<!-- HIDE FROM INCOMPATIBLE BROWSERS
Var answers = newArray(3);
var correctAnswers = newArray(3);
correctAnswers[0] = "a";
correctAnswers[1] = "a";
correctAnswers[2] = "a";
function recordAnswer(question, answer) {
answers[question-1] = answer;
}
function scoreQuiz1() {
var totalCorrect = 0;
for (var count = 0; count < correctAnswers.length;++count){
if (answers[count] == correctAnswers[count]) ++totalCorrect;
}
alert("You scored " + totalCorrect + " out of 3 answers correctly!");
}
//stop hiding from incompatible browsers-->
</SCRIPT>
<body bgcolor="EOEOEO">
<center><H3>Take this quiz!</h3></center>
<p>Answer the following questions then click the "Score Quiz" button to grade your quiz.</p>
<form>
<p><B>1.A Durango is....?</b></p>
<p><input type=radio name=question1 VALUE="a"
onClick score="recordAnswer(1, this.value)">a SUV<br>
<input type=radio name=question1 value="b"
onClick score="recordAnswer(1, this.value)">a camper<br>
<input type=radio name=question1 value="c"
onClick score="recordAnswer(1, this.value)">an all terrain vehicle<br></P>
<p><B>2. A 300M is...?</b></p>
<p><input type=radio name=question2 value="a"
onClick score="recordAnswer(2, this.value)">a Luxury car<br>
<input type=radio name=question2 value="b"
onClick score="recordAnswer(2, this.value)">a SUV<br>
<input type=radio name=question2 value="c"
onClick score="recordAnswer(2, this.value)">an all terrain vehicle<br></P>
<p><B>3.A Jeep can be...</b></p>
<p><input type=radio name=question3 value="a"
onClick score="recordAnswer(3, this.value)">any color<br>
<input type=radio name=question3 value="b"
onClick score="recordAnswer(3, this.value)">Red<br>
<input type=radio name=question3 value="c"
onClick score="recordAnswer(3, this.value)">Green<br></P>
<br>
<p><INPUT TYPE="button" VALUE="Score Quiz" onClick="scoreQuiz1();"></p>
</form>
</body>
</html>