Results 1 to 4 of 4

Thread: need help getting quiz to score

  1. #1
    Join Date
    Nov 2002

    Question need help getting quiz to score

    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.
    <TITLE>Car Quiz</TITLE>

    <A HREF="much ado.html">Return Home</a>
    <SCRIPT LANGUAGE="JavaScript">

    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-->

    <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>

    <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>
    <p><INPUT TYPE="button" VALUE="Score Quiz" onClick="scoreQuiz1();"></p>


  2. #2
    Join Date
    Nov 2002
    THANK YOU! THANK YOU! You really are the "master of the web"! I don't know why I had the script and body like they were. I closed the head and put the links in the body. THANK YOU for fixing the var for me. I changed a lot of things but not that particular item. I have spent hours on my site-which is a project for school and I need to walk away for awhile. Too much coding within a period of time I guess. I have one more page that has a problem. Using a form to register it should go automatically to the email address. I thought it would send it straight to my email and close the page or return home. It's probably something simple that I am just overlooking. Thanks again! (Do I need javaScript language on this page?)

    <Title>Customer Information</title>
    <A HREF= "much ado.html">Return home!</a>
    <body BACKGROUND="Blue hills.jpg">
    <h3>Register here for our newsletter!</h3>

    <form Action="mailto:jannahay@aol.com"
    method="post" enctype="text/plain" Name="customer_information">
    <input type="text" NAme="name" Size=50><br>
    <input type="text" Name="address" size=50><br>
    City, State, Zip<br>

    <input type="text" name="City" Size=35>
    <input type="text" name="State" Size=2 maxlength=2>
    <input type="text" name="Zip" Size=5 maxlength=5><br>

    E-mail address<br><p><input type="text" name="E-mail" Size=50></p>
    <input type="reset"><br>Click here<input type="image" src="rabbit jumping.gif">and your registration will be on its way!

  3. #3
    Join Date
    Nov 2002
    Sorry I wasn't clear! It seems to happen a lot to me when learning this JavaScript. When you fill out a registration form, should it go directly to an email account or open the email to fill in and send? I want--when you fill out the form and click send-- it sends the registration to my email. I guess I want it to send the registration form behind the scenes. When I click send now, it opens my email with the cursor in the subject line. And I don't know what is up with me the head/body tag issues! I'll fix that too but that doesn't change the way the program will run will it? Thanks...you are a godsend!

  4. #4
    Join Date
    Nov 2002
    THANKS SO MUCH!!! (you have no idea how much you have helped me)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center