www.webdeveloper.com
Results 1 to 4 of 4

Thread: need help getting quiz to score

  1. #1
    Join Date
    Nov 2002
    Posts
    4

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

  2. #2
    Join Date
    Nov 2002
    Posts
    4
    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?)

    <html>
    <head>
    <Title>Customer Information</title>
    </head>
    <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">
    Name<br>
    <input type="text" NAme="name" Size=50><br>
    Address<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!
    </body>
    </html>

  3. #3
    Join Date
    Nov 2002
    Posts
    4
    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
    Posts
    4
    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

"

"

X vBulletin 4.2.2 Debug Information

  • Page Generation 0.14236 seconds
  • Memory Usage 2,855KB
  • Queries Executed 13 (?)
More Information
Template Usage (32):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (4)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (70):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates