Web Analytics Made Easy -
StatCounter Javascript Quiz - CodingForum


No announcement yet.

Javascript Quiz

  • Filter
  • Time
  • Show
Clear All
new posts

  • Javascript Quiz

    I've designed a quiz similar to the What Am I? quizzes you see. They make selections from multiple choice questions and the most commonly picked option is given as the result. I hope you understand what I mean.

    My quiz is for users to pick which cours ewill be best for them...however, rather than just have one result...I would like it to give the top 3 results. For exampel if Accident was picked 5 times, Safety 3 times, and Asbestos 3 times. I'd like there to be a results page saying the top three courses for you are...


    This is the script for the results of the quiz at the moment:

    var out = "accident";
    i = acc;
    if (awa > i) { out = "awareness"; i = awa; }
    if (ris > i) { out = "risk"; i = ris; }
    if (cul> i) { out = "culture"; i = cul; }
    if (leg> i) { out = "legislation"; i = leg; }
    if (con> i) { out = "contractor"; i = con; }
    if (asb> i) { out = "asbestos"; i = asb; }
    if (neb> i) { out = "nebosh"; i = neb; }
    location.href = out + ".htm";
    function err(msg, url, line)
    location.href = "quizerror.htm";
    //window.onerror = err;
    // -->

    Is there a simple way to create what I want?

    If so could anyone point me in the right direction, I'm not by any means a Javascript expert and only managed to write this script by lifting code and editing it to my needs.

    I hope someone can help!

    Thanks very much,