www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Client-Side Development > JavaScript

    JavaScript JavaScript (not Java) Discussion and technical support, including AJAX and frameworks (JQuery, MooTools, Prototype...)

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1  
    Old 05-05-2005, 05:34 PM
    needhelp1234 needhelp1234 is offline
    Registered User
     
    Join Date: May 2005
    Posts: 31
    Help!

    AHH when i go to Submit Results now it says "undefined" even though i clicked the answers !! help again

    <SCRIPT LANGUAGE="JavaScript">
    <!--

    var question = new Array(); var answer = new Array(); var correctAnswer = new Array(); var userAnswer = new Array();
    question[1] = "What comedian had just started a new TV series, playing a mailman on \"The Royal Family,\" when he died of a heart attack in 1991?"
    correctAnswer[1] = "E"
    userAnswer[1] = ""
    answer[1] = "Bill Macy"
    answer[2] = "James Coco"
    answer[3] = "Gabriel Kaplan"
    answer[4] = "Charles Ruggles"
    answer[5] = "Redd Foxx"
    question[2] = "Who was Fred Astaire's dance partner in the movie musical \"Royal Wedding?\""
    correctAnswer[2] = "A"
    userAnswer[2] = ""
    answer[6] = "Jane Powell"
    answer[7] = "Cyd Charisse"
    answer[8] = "Judy Garland"
    answer[9] = "Kim Hunter"
    answer[10] = "Cathy Rigby"
    question[3] = "What golfer won consecutive British Opens at Royal Troon in 1982 and Royal Birkdale in 1983?"
    correctAnswer[3] = "D"
    userAnswer[3] = ""
    answer[11] = "Wayne Grady"
    answer[12] = "Nick Faldo"
    answer[13] = "Payne Stewart"
    answer[14] = "Tom Watson"
    answer[15] = "Jack Nicklaus"
    question[4] = "What golden insect sits on top of the Royal Exchange in London?"
    correctAnswer[4] = "A"
    userAnswer[4] = ""
    answer[16] = "Grasshopper"
    answer[17] = "Mantis"
    answer[18] = "Ant"
    answer[19] = "Wasp"
    answer[20] = "Mosquito"
    question[5] = "The Royal Gorge Bridge is the highest suspension bridge in the United States. In which U.S. state is it located?"
    correctAnswer[5] = "E"
    userAnswer[5] = ""
    answer[21] = "California"
    answer[22] = "Texas"
    answer[23] = "Montana"
    answer[24] = "New York"
    answer[25] = "Colorado"
    question[6] = "What is the official slogan of the Royal Canadian Mounted Police?"
    correctAnswer[6] = "B"
    userAnswer[6] = ""
    answer[26] = "\"We always get our man\""
    answer[27] = "\"Maintain the right\""
    answer[28] = "\"We are family\""
    answer[29] = "\"Be vigilant\""
    answer[30] = "\"One Mountie, one riot\""
    question[7] = "What comic strip character was the subject of a top ten novelty hit for the Royal Guardsmen in 1966?"
    correctAnswer[7] = "D"
    userAnswer[7] = ""
    answer[31] = "Popeye"
    answer[32] = "Beetle Bailey"
    answer[33] = "Alley Oop"
    answer[34] = "Snoopy"
    answer[35] = "Little Orphan Annie"
    question[8] = "How many lines of verse occur in the stanza form known as \"rhyme royal\"?"
    correctAnswer[8] = "C"
    userAnswer[8] = ""
    answer[36] = "4"
    answer[37] = "5"
    answer[38] = "7"
    answer[39] = "14"
    answer[40] = "16"

    function displayResults()
    {
    userAnswer[1] = document.answers.Question1.value;
    userAnswer[2] = document.answers.Question2.value;
    userAnswer[3] = document.answers.Question3.value;
    userAnswer[4] = document.answers.Question4.value;
    userAnswer[5] = document.answers.Question5.value;
    userAnswer[6] = document.answers.Question6.value;
    userAnswer[7] = document.answers.Question7.value;
    userAnswer[8] = document.answers.Question8.value;

    var correctIncorrect1;
    var correctIncorrect2;
    var correctIncorrect3;
    var correctIncorrect4;
    var correctIncorrect5;
    var correctIncorrect6;
    var correctIncorrect7;
    var correctIncorrect8;

    if (userAnswer[1] == correctAnswer[1])
    {
    correctIncorrect1 = "correct";
    }
    else
    {
    correctIncorrect1= "incorrect";
    }
    if (userAnswer[2] == correctAnswer[2])
    {
    correctIncorrect2 = "correct";
    }
    else
    {
    correctIncorrect2 = "incorrect";
    }
    if (userAnswer[3] == correctAnswer[3])
    {
    correctIncorrect3 = "correct";
    }
    else
    {
    correctIncorrect3 = "incorrect";
    }
    if (userAnswer[4] == correctAnswer[4])
    {
    correctIncorrect4 = "correct";
    }
    else
    {
    correctIncorrect4 = "incorrect";
    }
    if (userAnswer[5] == correctAnswer[5])
    {
    correctIncorrect5 = "correct";
    }
    else
    {
    correctIncorrect5 = "incorrect";
    }
    if (userAnswer[6] == correctAnswer[6])
    {
    correctIncorrect6 = "correct";
    }
    else
    {
    correctIncorrect6 = "incorrect";
    }
    if (userAnswer[7] == correctAnswer[7])
    {
    correctIncorrect7 = "correct";
    }
    else
    {
    correctIncorrect7 = "incorrect";
    }
    if (userAnswer[8] == correctAnswer[8])
    {
    correctIncorrect8 = "correct";
    }
    else
    {
    correctIncorrect8 = "incorrect";
    }


    var content="<HTML><HEAD><TITLE>Quiz Results</TITLE></HEAD>"+
    "<BODY><CENTER><H1>Quiz Results</H1></CENTER><P>" +
    "<FONT COLOR='0000FF'><B>" +
    "Question 1 was, \"" + question[1] + "\"<BR>" + "Your answer was, \"" + userAnswer[1] + ".\"<BR>" +
    "The correct answer was, \"" + correctAnswer[1] + ".\"<BR>" +
    "You were " + correctIncorrect1 + ".<P>" +
    "Question 2 was, \"" + question[2] + "\"<BR>"
    + "Your answer was, \"" + userAnswer[2] + ".\"<BR>" +
    "The correct answer was, \"" + correctAnswer[2] + ".\"<BR>" +
    "You were " + correctIncorrect2 + ".<P>" +
    "Question 3 was, \"" + question[3] + "\"<BR>" + "Your answer was, \"" + userAnswer[3] + ".\"<BR>" +
    "The correct answer was, \"" + correctAnswer[3] + ".\"<BR>" +
    "You were " + correctIncorrect3 + ".<P>" +
    "Question 4 was, \"" + question[4] + "\"<BR>" + "Your answer was, \"" + userAnswer[4] + ".\"<BR>" +
    "The correct answer was, \"" + correctAnswer[4] + ".\"<BR>" +
    "You were " + correctIncorrect4 + ".<P>" +
    "Question 5 was, \"" + question[5] + "\"<BR>" + "Your answer was, \"" + userAnswer[5] + ".\"<BR>" + "The correct answer was, \"" + correctAnswer[5] + ".\"<BR>" +
    "You were " + correctIncorrect5 + ".<P>" +
    "Question 6 was, \"" + question[6] + "\"<BR>" + "Your answer was, \"" + userAnswer[6] + ".\"<BR>" + "The correct answer was, \"" +
    "\"" + correctAnswer[6] + ".\"<BR>" +
    "You were " + correctIncorrect6 + ".<P>" +
    "Question 7 was, \"" + question[7] + "\"<BR>" + "Your answer was, \"" + userAnswer[7] + ".\"<BR>" + "The correct answer was, \"" + correctAnswer[7] + ".\"<BR>" +
    "You were " + correctIncorrect7 + ".<P>" +
    "Question 8 was, \"" + question[8] + "\"<BR>" + "Your answer was, \"" + userAnswer[8] + ".\"<BR>" + "The correct answer was, \"" + correctAnswer[8] + ".\"<BR>" +
    "You were " + correctIncorrect8 + ".<P>";
    //Line 202
    document.open();
    document.write(content);
    document.close();
    }

    // -->
    </SCRIPT>
    </HEAD>
    <BODY>
    <CENTER>
    <H2>
    <FONT COLOR="#FF0000">
    Welcome to the JavaScript quiz!
    </FONT>
    </H2>
    </CENTER>
    <P>
    <H3>
    <FORM METHOD=POST NAME="answers">
    1. What comedian had just started a new TV series, playing a mailman on "The Royal Family," when he died of a heart attack in 1991?
    <BR>
    <INPUT TYPE="RADIO" NAME="Question1" VALUE="A" checked> A. Bill Macy
    <BR>
    <INPUT TYPE="RADIO" NAME="Question1" VALUE="B"> B. Cyd Charisse
    <BR>
    <INPUT TYPE="RADIO" NAME="Question1" VALUE="C"> C. Gabriel Kaplan
    <BR>
    <INPUT TYPE="RADIO" NAME="Question1" VALUE="D"> D. Charles Ruggles
    <BR>
    <INPUT TYPE="RADIO" NAME="Question1" VALUE="E"> E. Redd Foxx
    <P>
    2. Who was Fred Astaire's dance partner in the movie musical "Royal Wedding?"
    <BR>
    <INPUT TYPE="RADIO" NAME="Question2" VALUE="A" checked> A. Jane Powell
    <BR>
    <INPUT TYPE="RADIO" NAME="Question2" VALUE="B"> B. Cyd Charisse
    <BR>
    <INPUT TYPE="RADIO" NAME="Question2" VALUE="C"> C. Judy Garland
    <BR>
    <INPUT TYPE="RADIO" NAME="Question2" VALUE="D"> D. Kim Hunter
    <BR>
    <INPUT TYPE="RADIO" NAME="Question2" VALUE="E"> E. Cathy Rigby
    <P>
    3. What golfer won consecutive British Opens at Royal Troon in 1982 and Royal Birkdale in 1983?
    <BR>
    <INPUT TYPE="RADIO" NAME="Question3" VALUE="A" checked> A. Wayne Grady
    <BR>
    <INPUT TYPE="RADIO" NAME="Question3" VALUE="B"> B. Nick Faldo
    <BR>
    <INPUT TYPE="RADIO" NAME="Question3" VALUE="C"> C. Payne Stewart
    <BR>
    <INPUT TYPE="RADIO" NAME="Question3" VALUE="D"> D. Tom Watson
    <BR>
    <INPUT TYPE="RADIO" NAME="Question3" VALUE="E"> E. Jack Nicklaus
    <P>
    4. What golden insect sits on top of the Royal Exchange in London?
    <BR>
    <INPUT TYPE="RADIO" NAME="Question4" VALUE="A" checked> A. Grasshopper
    <BR>
    <INPUT TYPE="RADIO" NAME="Question4" VALUE="B"> B. Mantis
    <BR>
    <INPUT TYPE="RADIO" NAME="Question4" VALUE="C"> C. Ant
    <BR>
    <INPUT TYPE="RADIO" NAME="Question4" VALUE="D"> D. Wasp
    <BR>
    <INPUT TYPE="RADIO" NAME="Question4" VALUE="E"> E. Mosquito
    <P>
    5. The Royal Gorge Bridge is the highest suspension bridge in the United States. In which U.S. state is it located?
    <BR>
    <INPUT TYPE="RADIO" NAME="Question5" VALUE="A" checked> A. California
    <BR>
    <INPUT TYPE="RADIO" NAME="Question5" VALUE="B"> B. Texas
    <BR>
    <INPUT TYPE="RADIO" NAME="Question5" VALUE="C"> C. Montana
    <BR>
    <INPUT TYPE="RADIO" NAME="Question5" VALUE="D"> D. New York
    <BR>
    <INPUT TYPE="RADIO" NAME="Question5" VALUE="E"> E. Colorado
    <P>
    6. What is the official slogan of the Royal Canadian Mounted Police?
    <BR>
    <INPUT TYPE="RADIO" NAME="Question6" VALUE="A" checked> A. "We always get our man"
    <BR>
    <INPUT TYPE="RADIO" NAME="Question6" VALUE="B"> B. "Maintain the right"
    <BR>
    <INPUT TYPE="RADIO" NAME="Question6" VALUE="C"> C. "We are family"
    <BR>
    <INPUT TYPE="RADIO" NAME="Question6" VALUE="D"> D. "Be vigilant"
    <BR>
    <INPUT TYPE="RADIO" NAME="Question6" VALUE="E"> E. "One Mountie, one riot"
    <P>
    7. What comic strip character was the subject of a top ten novelty hit for the Royal Guardsmen in 1966?
    <BR>
    <INPUT TYPE="RADIO" NAME="Question7" VALUE="A" checked> A. Popeye
    <BR>
    <INPUT TYPE="RADIO" NAME="Question7" VALUE="B"> B. Beetle Bailey
    <BR>
    <INPUT TYPE="RADIO" NAME="Question7" VALUE="C"> C. Alley Oop
    <BR>
    <INPUT TYPE="RADIO" NAME="Question7" VALUE="D"> D. Snoopy
    <BR>
    <INPUT TYPE="RADIO" NAME="Question7" VALUE="E"> E. Little Orphan Annie
    <P>
    8. How many lines of verse occur in the stanza form known as "rhyme royal"?
    <BR>
    <INPUT TYPE="RADIO" NAME="Question8" VALUE="A" checked> A. 4
    <BR>
    <INPUT TYPE="RADIO" NAME="Question8" VALUE="B"> B. 5
    <BR>
    <INPUT TYPE="RADIO" NAME="Question8" VALUE="C"> C. 7
    <BR>
    <INPUT TYPE="RADIO" NAME="Question8" VALUE="D"> D. 14
    <BR>
    <INPUT TYPE="RADIO" NAME="Question8" VALUE="E"> E. 16
    <P>
    <CENTER>
    <INPUT TYPE="BUTTON" VALUE="Submit Quiz" onClick="displayResults();">
    <INPUT TYPE="BUTTON" VALUE="Reset">
    </FORM>
    Reply With Quote
      #2  
    Old 05-05-2005, 05:52 PM
    Ultimater's Avatar
    Ultimater Ultimater is offline
    Eccentric Tatertot
     
    Join Date: Jan 2005
    Location: Los Angeles, CA
    Posts: 4,827
    Please stay in the same thread next time
    rename the file to: deggued_script1213.html
    Attached Files
    File Type: txt deggued_script1213.html.txt (9.9 KB, 68 views)
    __________________
    Ultimater

    XMLHttpRequest:
    Specification | xmlhttp object | open and onreadystatechange order | String.prototype.toXMLDocument | Sarissa | Prototype | Dojo
    Broadening one's horizons:
    24ways.org


    Note I have a bad habit of editing my posts hours at a time and hours later.
    Reply With Quote
      #3  
    Old 05-05-2005, 07:06 PM
    needhelp1234 needhelp1234 is offline
    Registered User
     
    Join Date: May 2005
    Posts: 31
    LAST THING..Sorry for the nuisance.
    1. i want the last button to display the number right out of 10 questions and percentage
    2. I want to make it 15 Questions and to math.round 10 so where would i put that code

    <HTML>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    var 1= correctIncorrect1 +correctIncorrect2 +correctIncorrect3 +correctIncorrect4 +correctIncorrect5 +correctIncorrect6 +correctIncorrect7 +correctIncorrect8
    var 2= 1 / 10 * 100
    var AA=["A","B","C","D","E"]
    var question = new Array(); var answer = new Array(); var correctAnswer = new Array(); var userAnswer = new Array();
    question[1] = "Where Did Homer and Bart Find Santas little Helper"
    correctAnswer[1] = "D"
    userAnswer[1] = ""
    answer[1] = "At a Pet Store"
    answer[2] = "School"
    answer[3] = "Dog Pound"
    answer[4] = "Dog Race"
    question[2] = "What Are the Name's Of Marges Sisters"
    correctAnswer[2] = "A"
    userAnswer[2] = ""
    answer[5] = "Patty and Selma"
    answer[6] = "Patsy and Selma "
    answer[7] = "Patty and Selina"
    answer[8] = "Patsy and Selina"
    question[3] = "Who is Homers Boss?"
    correctAnswer[3] = "C"
    userAnswer[3] = ""
    answer[9] = "Mr Smithers"
    answer[10] = "Mr Hibbert"
    answer[11] = "Mr Burns"
    answer[12] = "Mr Clevon"
    question[4] = "What is the name of Homer's Neighbour"
    correctAnswer[4] = "A"
    userAnswer[4] = ""
    answer[13] = "Ned"
    answer[14] = "Reverend"
    answer[15] = "Moe"
    answer[16] = "Barney"
    question[5] = "Which of the following is *not* Barts Catchphrase?"
    correctAnswer[5] = "D"
    userAnswer[5] = ""
    answer[17] = "Dont Have a cow, man"
    answer[18] = "Im Bart Simpson, who the hell are you?"
    answer[19] = "No Problemo"
    answer[20] = "Take It easy, Dude"
    question[6] = "What was Maggie's first word?"
    correctAnswer[6] = "B"
    userAnswer[6] = ""
    answer[21] = "Mommy"
    answer[22] = "Daddy"
    answer[23] = "Bart"
    answer[24] = "Lisa"
    question[7] = "What is the name of the School Bully?"
    correctAnswer[7] = "C"
    userAnswer[7] = ""
    answer[25] = "Tim"
    answer[26] = "Ralph"
    answer[27] = "Neilson"
    answer[28] = "Martin"
    question[8] = "What is the name of the Groundsman at school?"
    correctAnswer[8] = "C"
    userAnswer[8] = ""
    answer[29] = "Groundskeeper Wallie"
    answer[30] = "Groundskeeper Billie"
    answer[31] = "Groundskeeper Willie"
    answer[32] = "Groundskeeper Ballie"
    function getChecked(){
    for(var i=0;i<arguments[0].length;i++)
    if(arguments[0][i].checked==true)return AA[i]
    return "not answered"
    }
    function displayResults()
    {
    userAnswer[1] = getChecked(document.answers.Question1)

    userAnswer[2] = getChecked(document.answers.Question2);
    userAnswer[3] = getChecked(document.answers.Question3);
    userAnswer[4] = getChecked(document.answers.Question4);
    userAnswer[5] = getChecked(document.answers.Question5);
    userAnswer[6] = getChecked(document.answers.Question6);
    userAnswer[7] = getChecked(document.answers.Question7);
    userAnswer[8] = getChecked(document.answers.Question8);

    var correctIncorrect1;
    var correctIncorrect2;
    var correctIncorrect3;
    var correctIncorrect4;
    var correctIncorrect5;
    var correctIncorrect6;
    var correctIncorrect7;
    var correctIncorrect8;

    if (userAnswer[1] == correctAnswer[1])
    {
    correctIncorrect1 = "correct";
    }
    else
    {
    correctIncorrect1= "incorrect";
    }
    if (userAnswer[2] == correctAnswer[2])
    {
    correctIncorrect2 = "correct";
    }
    else
    {
    correctIncorrect2 = "incorrect";
    }
    if (userAnswer[3] == correctAnswer[3])
    {
    correctIncorrect3 = "correct";
    }
    else
    {
    correctIncorrect3 = "incorrect";
    }
    if (userAnswer[4] == correctAnswer[4])
    {
    correctIncorrect4 = "correct";
    }
    else
    {
    correctIncorrect4 = "incorrect";
    }
    if (userAnswer[5] == correctAnswer[5])
    {
    correctIncorrect5 = "correct";
    }
    else
    {
    correctIncorrect5 = "incorrect";
    }
    if (userAnswer[6] == correctAnswer[6])
    {
    correctIncorrect6 = "correct";
    }
    else
    {
    correctIncorrect6 = "incorrect";
    }
    if (userAnswer[7] == correctAnswer[7])
    {
    correctIncorrect7 = "correct";
    }
    else
    {
    correctIncorrect7 = "incorrect";
    }
    if (userAnswer[8] == correctAnswer[8])
    {
    correctIncorrect8 = "correct";
    }
    else
    {
    correctIncorrect8 = "incorrect";
    }


    var content="<HTML><HEAD><TITLE>Quiz Results</TITLE></HEAD>"+
    "<BODY><CENTER><H1>Quiz Results</H1></CENTER><P>" +
    "<FONT COLOR='0000FF'><B>" +
    "Question 1 was, \"" + question[1] + "\"<BR>" + "Your answer was, \"" + userAnswer[1] + ".\"<BR>" +
    "The correct answer was, \"" + correctAnswer[1] + ".\"<BR>" +
    "You were " + correctIncorrect1 + ".<P>" +
    "Question 2 was, \"" + question[2] + "\"<BR>"
    + "Your answer was, \"" + userAnswer[2] + ".\"<BR>" +
    "The correct answer was, \"" + correctAnswer[2] + ".\"<BR>" +
    "You were " + correctIncorrect2 + ".<P>" +
    "Question 3 was, \"" + question[3] + "\"<BR>" + "Your answer was, \"" + userAnswer[3] + ".\"<BR>" +
    "The correct answer was, \"" + correctAnswer[3] + ".\"<BR>" +
    "You were " + correctIncorrect3 + ".<P>" +
    "Question 4 was, \"" + question[4] + "\"<BR>" + "Your answer was, \"" + userAnswer[4] + ".\"<BR>" +
    "The correct answer was, \"" + correctAnswer[4] + ".\"<BR>" +
    "You were " + correctIncorrect4 + ".<P>" +
    "Question 5 was, \"" + question[5] + "\"<BR>" + "Your answer was, \"" + userAnswer[5] + ".\"<BR>" + "The correct answer was, \"" + correctAnswer[5] + ".\"<BR>" +
    "You were " + correctIncorrect5 + ".<P>" +
    "Question 6 was, \"" + question[6] + "\"<BR>" + "Your answer was, \"" + userAnswer[6] + ".\"<BR>" + "The correct answer was, \"" +
    "\"" + correctAnswer[6] + ".\"<BR>" +
    "You were " + correctIncorrect6 + ".<P>" +
    "Question 7 was, \"" + question[7] + "\"<BR>" + "Your answer was, \"" + userAnswer[7] + ".\"<BR>" + "The correct answer was, \"" + correctAnswer[7] + ".\"<BR>" +
    "You were " + correctIncorrect7 + ".<P>" +
    "Question 8 was, \"" + question[8] + "\"<BR>" + "Your answer was, \"" + userAnswer[8] + ".\"<BR>" + "The correct answer was, \"" + correctAnswer[8] + ".\"<BR>" +
    "You were " + correctIncorrect8 + ".<P>";
    //Line 202
    document.open();
    document.write(content);
    document.close();

    }

    // -->
    </SCRIPT>
    </HEAD>
    <BODY>
    <CENTER>
    <H2>
    <FONT COLOR="#FF0000">
    Welcome to the JavaScript quiz!
    </FONT>
    </H2>
    </CENTER>
    <P>
    <H3>
    <FORM METHOD=POST NAME="answers">
    1. Where did Homer and Bart Find Santas Little Helper?
    <BR>
    <INPUT TYPE="RADIO" NAME="Question1" VALUE="A"> A. At a Pet Store
    <BR>
    <INPUT TYPE="RADIO" NAME="Question1" VALUE="B"> B. Alleyway
    <BR>
    <INPUT TYPE="RADIO" NAME="Question1" VALUE="C"> C. Dog Pound
    <BR>
    <INPUT TYPE="RADIO" NAME="Question1" VALUE="D"> D. Dog Race
    <P>
    2. What Are the Name's Of Marges Sisters
    <BR>
    <INPUT TYPE="RADIO" NAME="Question2" VALUE="A"> A. Patty and Selma
    <BR>
    <INPUT TYPE="RADIO" NAME="Question2" VALUE="B"> B. Patsy and Selma
    <BR>
    <INPUT TYPE="RADIO" NAME="Question2" VALUE="C"> C. Patty and Selina
    <BR>
    <INPUT TYPE="RADIO" NAME="Question2" VALUE="D"> D. Patsy and Selina
    <P>
    3. Who is Homer's Boss
    <BR>
    <INPUT TYPE="RADIO" NAME="Question3" VALUE="A"> A. Mr.Smithers
    <BR>
    <INPUT TYPE="RADIO" NAME="Question3" VALUE="B"> B. Mr.Hibbert
    <BR>
    <INPUT TYPE="RADIO" NAME="Question3" VALUE="C"> C. Mr.Burns
    <BR>
    <INPUT TYPE="RADIO" NAME="Question3" VALUE="D"> D. Mr.Clevon
    <P>
    4. What is the name of Homer's Neighbour?
    <BR>
    <INPUT TYPE="RADIO" NAME="Question4" VALUE="A"> A. Ned
    <BR>
    <INPUT TYPE="RADIO" NAME="Question4" VALUE="B"> B. Reverend
    <BR>
    <INPUT TYPE="RADIO" NAME="Question4" VALUE="C"> C. Moe
    <BR>
    <INPUT TYPE="RADIO" NAME="Question4" VALUE="D"> D. Barney
    <P>
    5. Which of the following is *not* a Bart Simpsons catchphrase?
    <BR>
    <INPUT TYPE="RADIO" NAME="Question5" VALUE="A"> A. Dont Have a cow man
    <BR>
    <INPUT TYPE="RADIO" NAME="Question5" VALUE="B"> B. Im Bart Simpson, who the hell are you?
    <BR>
    <INPUT TYPE="RADIO" NAME="Question5" VALUE="C"> C. No Problemo
    <BR>
    <INPUT TYPE="RADIO" NAME="Question5" VALUE="D"> D. Take it Easy, Dude
    <P>
    6. What was Maggie's First Word
    <BR>
    <INPUT TYPE="RADIO" NAME="Question6" VALUE="A"> A. Mommy
    <BR>
    <INPUT TYPE="RADIO" NAME="Question6" VALUE="B"> B. Daddy
    <BR>
    <INPUT TYPE="RADIO" NAME="Question6" VALUE="C"> C. Bart
    <BR>
    <INPUT TYPE="RADIO" NAME="Question6" VALUE="D"> D. Lisa
    <P>
    7.What is the name of the School Bully?
    <BR>
    <INPUT TYPE="RADIO" NAME="Question7" VALUE="A"> A. Tim
    <BR>
    <INPUT TYPE="RADIO" NAME="Question7" VALUE="B"> B. Ralph
    <BR>
    <INPUT TYPE="RADIO" NAME="Question7" VALUE="C"> C. Neilson
    <BR>
    <INPUT TYPE="RADIO" NAME="Question7" VALUE="D"> D. Martin
    <P>
    8.What is the name of the Groundsman and School?
    <BR>
    <INPUT TYPE="RADIO" NAME="Question8" VALUE="A"> A. Groundskeeper Billie
    <BR>
    <INPUT TYPE="RADIO" NAME="Question8" VALUE="B"> B. Groundskeeper Wallie
    <BR>
    <INPUT TYPE="RADIO" NAME="Question8" VALUE="C"> C. Groundskeeper Willie
    <BR>
    <INPUT TYPE="RADIO" NAME="Question8" VALUE="D"> D. Groundskeeper Ballie
    <P>
    <CENTER>
    <INPUT TYPE="BUTTON" VALUE="Submit Quiz" onClick="displayResults();">
    <INPUT TYPE="BUTTON" VALUE="Quick Mark" onClick="window.alert('You Got '+1+' Out of 10 which is '+2+' Percent')">
    </FORM>
    </BODY>
    <HTML>
    Reply With Quote
      #4  
    Old 05-05-2005, 07:07 PM
    needhelp1234 needhelp1234 is offline
    Registered User
     
    Join Date: May 2005
    Posts: 31
    To The Top Code how would i math.round 15 questions to display 10, and how would i get it to window.alert the amount u got right out of 10 and percentage out 10 . (im going to add 2 more questions)
    Reply With Quote
      #5  
    Old 05-05-2005, 07:10 PM
    Ultimater's Avatar
    Ultimater Ultimater is offline
    Eccentric Tatertot
     
    Join Date: Jan 2005
    Location: Los Angeles, CA
    Posts: 4,827
    I'm in the middle of a different project right now;
    http://www.webdeveloper.com/forum/sh...ad.php?t=64867
    afterwards I'll get around to it.
    __________________
    Ultimater

    XMLHttpRequest:
    Specification | xmlhttp object | open and onreadystatechange order | String.prototype.toXMLDocument | Sarissa | Prototype | Dojo
    Broadening one's horizons:
    24ways.org


    Note I have a bad habit of editing my posts hours at a time and hours later.
    Reply With Quote
      #6  
    Old 05-05-2005, 08:11 PM
    Ultimater's Avatar
    Ultimater Ultimater is offline
    Eccentric Tatertot
     
    Join Date: Jan 2005
    Location: Los Angeles, CA
    Posts: 4,827
    Ok, I finished that dudes graph, at least until he gives me feedback.
    Quote:
    Originally Posted by needhelp1234
    To The Top Code how would i math.round 15 questions to display 10, and how would i get it to window.alert the amount u got right out of 10 and percentage out 10 . (im going to add 2 more questions)
    So you want what?
    I can simplify your whole quiz. I probably can at least half your code-size.
    I understand that you want to add 2 more question and you want a score display.
    But what does "To The Top Code how would i math.round 15 questions to display 10" mean?
    __________________
    Ultimater

    XMLHttpRequest:
    Specification | xmlhttp object | open and onreadystatechange order | String.prototype.toXMLDocument | Sarissa | Prototype | Dojo
    Broadening one's horizons:
    24ways.org


    Note I have a bad habit of editing my posts hours at a time and hours later.
    Reply With Quote
      #7  
    Old 05-05-2005, 08:24 PM
    needhelp1234 needhelp1234 is offline
    Registered User
     
    Join Date: May 2005
    Posts: 31
    I need to make a quiz that has 15 questions, but math.random only 10 of them. and at the end i want it to say the amount of questiosn they got right out of 10 and the percentage.
    IMPORTANT: Use arrays , radios, and javascript only !
    Reply With Quote
      #8  
    Old 05-05-2005, 08:32 PM
    Ultimater's Avatar
    Ultimater Ultimater is offline
    Eccentric Tatertot
     
    Join Date: Jan 2005
    Location: Los Angeles, CA
    Posts: 4,827
    Ah, Math.random them is different from Math.round them! IC. OK
    __________________
    Ultimater

    XMLHttpRequest:
    Specification | xmlhttp object | open and onreadystatechange order | String.prototype.toXMLDocument | Sarissa | Prototype | Dojo
    Broadening one's horizons:
    24ways.org


    Note I have a bad habit of editing my posts hours at a time and hours later.
    Reply With Quote
      #9  
    Old 05-05-2005, 08:34 PM
    needhelp1234 needhelp1234 is offline
    Registered User
     
    Join Date: May 2005
    Posts: 31
    yeah was a mistake sorry..you are helping me sooo much thank you so much! this is helping me out alot. Ill stay on until your done.or will you need the night?
    Reply With Quote
      #10  
    Old 05-05-2005, 09:04 PM
    Ultimater's Avatar
    Ultimater Ultimater is offline
    Eccentric Tatertot
     
    Join Date: Jan 2005
    Location: Los Angeles, CA
    Posts: 4,827
    Yo, would you mind If I re-write the whole thing? It's such spaghetti code.
    My way should make the code much easier to maintain.
    BTW: that finished code shouldn't take longer than 30 minutes
    __________________
    Ultimater

    XMLHttpRequest:
    Specification | xmlhttp object | open and onreadystatechange order | String.prototype.toXMLDocument | Sarissa | Prototype | Dojo
    Broadening one's horizons:
    24ways.org


    Note I have a bad habit of editing my posts hours at a time and hours later.

    Last edited by Ultimater; 05-05-2005 at 09:06 PM.
    Reply With Quote
      #11  
    Old 05-05-2005, 09:05 PM
    needhelp1234 needhelp1234 is offline
    Registered User
     
    Join Date: May 2005
    Posts: 31
    Nope redo it jus rember im in high school dont make it too professional..but yeah you can re-write as much as you want as long as its..radio, arrays and in javascript..remember math.round 15 questions i gota put in..once again thank you
    Reply With Quote
      #12  
    Old 05-05-2005, 09:06 PM
    needhelp1234 needhelp1234 is offline
    Registered User
     
    Join Date: May 2005
    Posts: 31
    actually make it professional and easier to edit ...do what you wish and yeah ...jus radio..arrays javascirpt ..math.round as long as those are there im good
    Reply With Quote
      #13  
    Old 05-05-2005, 09:10 PM
    needhelp1234 needhelp1234 is offline
    Registered User
     
    Join Date: May 2005
    Posts: 31
    okay ..gr 10 level -
    Reply With Quote
      #14  
    Old 05-05-2005, 09:10 PM
    Ultimater's Avatar
    Ultimater Ultimater is offline
    Eccentric Tatertot
     
    Join Date: Jan 2005
    Location: Los Angeles, CA
    Posts: 4,827
    Can ya go through all your questions and re-write them in the following format:
    Code:
    question[1] = "Where Did Homer and Bart Find Santas little Helper"
    correctAnswer[1] = "D"
    userAnswer[1] = ""
    answer[1] = "At a Pet Store"
    answer[2] = "School"
    answer[3] = "Dog Pound"
    answer[4] = "Dog Race"
    Should turn into:
    Code:
    new Question("Where Did Homer and Bart Find Santas little Helper","D","At a Pet Store","School","Dog Pound","Dog Race")
    Then just post it up for me while I'm creating the rest.
    __________________
    Ultimater

    XMLHttpRequest:
    Specification | xmlhttp object | open and onreadystatechange order | String.prototype.toXMLDocument | Sarissa | Prototype | Dojo
    Broadening one's horizons:
    24ways.org


    Note I have a bad habit of editing my posts hours at a time and hours later.
    Reply With Quote
      #15  
    Old 05-05-2005, 09:13 PM
    needhelp1234 needhelp1234 is offline
    Registered User
     
    Join Date: May 2005
    Posts: 31
    says undefined dough
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 12:58 PM.



    Acceptable Use Policy


    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.