title: Grade Quiz After Submit Button is Clicked
body: <p>I am attempting to write a simple ten question quiz. However, I am running into a problem; I cannot get the code for grading to run after the submit button is clicked. Can someone please help?</p>
  
  <p>HTML Code:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt; 
  &lt;title&gt;Quiz #1&lt;/title&gt;
  
  &lt;link href="quiz.css" rel="stylesheet" type="text/css" /&gt;
  &lt;link href="reset.css" rel="stylesheet" type="text/css" /&gt;
  
  &lt;script src="quiz.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"
  type="text/javascript"&gt;&lt;/script&gt;
  
  &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;div class="center"&gt;
  
  &lt;div id="questionContainer"&gt;
  
  &lt;div id="header"&gt;
      &lt;h1&gt;State Capitol Quiz&lt;/h1&gt;
  &lt;/div&gt;
  
  &lt;div id="left"&gt;
  
  &lt;form action="quiz.html" class="container"&gt;
  &lt;div class="blank"&gt;
  &lt;br /&gt;
      &lt;br /&gt;
          &lt;p id="one"&gt;1.&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;What is the capitol of Michigan?&lt;br /&gt;
              &lt;div class="tab"&gt;
                  &lt;input type="radio" name="question" value="A" /&gt;&amp;nbsp;Lansing&lt;br /&gt;
                  &lt;input type="radio" name="question" value="B" /&gt;&amp;nbsp;Richmond&lt;br /&gt;
                  &lt;input type="radio" name="question" value="C" /&gt;&amp;nbsp;Austin&lt;br /&gt;
                  &lt;input type="radio" name="question" value="D" /&gt;&amp;nbsp;Columbus&lt;br /&gt;
              &lt;/div&gt;
          &lt;/p&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  
  &lt;form action="quiz.html" class="container"&gt;
  &lt;div class="blank"&gt;
  &lt;br /&gt;
  &lt;br /&gt;
      &lt;p id="two"&gt;2.&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;What is the capitol of Virginia?&lt;br /&gt;
         &lt;div class="tab"&gt;
              &lt;input type="radio" name="question" value="A" /&gt;&amp;nbsp;Lansing&lt;br /&gt;
              &lt;input type="radio" name="question" value="B" /&gt;&amp;nbsp;Richmond&lt;br /&gt;
              &lt;input type="radio" name="question" value="C" /&gt;&amp;nbsp;Lincoln&lt;br /&gt;
              &lt;input type="radio" name="question" value="D" /&gt;&amp;nbsp;Reno&lt;br /&gt;
        &lt;/div&gt;
     &lt;/p&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  
  &lt;form action="quiz.html" class="container"&gt;
  &lt;div class="blank"&gt;
  &lt;br /&gt;
  &lt;br /&gt;
      &lt;p id="three"&gt;3.&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;What is the capitol of Arkansas?&lt;br /&gt;
          &lt;div class="tab"&gt;  
              &lt;input type="radio" name="question" value="A" /&gt;&amp;nbsp;Dallas&lt;br /&gt;
              &lt;input type="radio" name="question" value="B" /&gt;&amp;nbsp;Lincoln&lt;br /&gt;
              &lt;input type="radio" name="question" value="C" /&gt;&amp;nbsp;Little Rock&lt;br /&gt;
              &lt;input type="radio" name="question" value="D" /&gt;&amp;nbsp;Cheyene&lt;br /&gt;
          &lt;/div&gt;
      &lt;/p&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  
  &lt;form action="quiz.html" class="container"&gt;
  &lt;div class="blank"&gt;
  &lt;br /&gt;
  &lt;br /&gt;
      &lt;p id="four"&gt;4.&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;What is the capitol of Arizona?&lt;br /&gt;
          &lt;div class="tab"&gt; 
              &lt;input type="radio" name="question" value="A" /&gt;&amp;nbsp;Juneau&lt;br /&gt;
              &lt;input type="radio" name="question" value="B" /&gt;&amp;nbsp;Honolulu&lt;br /&gt;
              &lt;input type="radio" name="question" value="C" /&gt;&amp;nbsp;Pheonix&lt;br /&gt;
              &lt;input type="radio" name="question" value="D" /&gt;&amp;nbsp;Toledo&lt;br /&gt;
          &lt;/div&gt;
      &lt;/p&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  
  &lt;form action="quiz.html" class="container"&gt;
  &lt;div class="blank"&gt;
  &lt;br /&gt;
  &lt;br /&gt;
      &lt;p id="five"&gt;5.&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;What is the capitol of Florida?&lt;br /&gt; 
          &lt;div class="tab"&gt; 
              &lt;input type="radio" name="question" value="A" /&gt;&amp;nbsp;Oakland&lt;br /&gt;
              &lt;input type="radio" name="question" value="B" /&gt;&amp;nbsp;Kansas City&lt;br /&gt;
              &lt;input type="radio" name="question" value="C" /&gt;&amp;nbsp;Tallahassee&lt;br /&gt;
              &lt;input type="radio" name="question" value="D" /&gt;&amp;nbsp;Miami&lt;br /&gt;
          &lt;/div&gt;
      &lt;/p&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  
  &lt;form action="quiz.html" class="container"&gt;
  &lt;div class="blank"&gt;
  &lt;br /&gt;
  &lt;br /&gt;
      &lt;p id="six"&gt;6.&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;What is the capitol of Nebraska?&lt;br /&gt;
          &lt;div class="tab"&gt;  
              &lt;input type="radio" name="question" value="A" /&gt;&amp;nbsp;Omaha&lt;br /&gt;
              &lt;input type="radio" name="question" value="B" /&gt;&amp;nbsp;Lincoln&lt;br /&gt;
              &lt;input type="radio" name="question" value="C" /&gt;&amp;nbsp;Sacramento&lt;br /&gt;
          &lt;input type="radio" name="question" value="D" /&gt;&amp;nbsp;Sab Diego&lt;br /&gt;
          &lt;/div&gt;
      &lt;/p&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  &lt;/div&gt;
  
  &lt;div id="right"&gt;
  &lt;form action="quiz.html" class="container"&gt;
  &lt;br /&gt;
  &lt;br /&gt;
  &lt;div class="blank"&gt;
      &lt;p id="seven"&gt;7.&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;What is the capitol of Texas?&lt;br /&gt;
          &lt;div class="tab"&gt;    
              &lt;input type="radio" name="question" value="A" /&gt;&amp;nbsp;Fortworth&lt;br /&gt;
              &lt;input type="radio" name="question" value="B" /&gt;&amp;nbsp;Richmond&lt;br /&gt;
              &lt;input type="radio" name="question" value="C" /&gt;&amp;nbsp;Austin&lt;br /&gt;
              &lt;input type="radio" name="question" value="D" /&gt;&amp;nbsp;Las Vegas&lt;br /&gt;
          &lt;/div&gt;
      &lt;/p&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  
  &lt;form action="quiz.html" class="container"&gt;
  &lt;div class="blank"&gt;
      &lt;p id="eight"&gt;8.&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;What is the capitol of Alaska?&lt;br /&gt;
          &lt;div class="tab"&gt;   
              &lt;input type="radio" name="question" value="A" /&gt;&amp;nbsp;Tulsa&lt;br /&gt;
              &lt;input type="radio" name="question" value="B" /&gt;&amp;nbsp;Oaklahoma City&lt;br /&gt;
              &lt;input type="radio" name="question" value="C" /&gt;&amp;nbsp;Austin&lt;br /&gt;
          &lt;input type="radio" name="question" value="D" /&gt;&amp;nbsp;Juneau&lt;br /&gt;
          &lt;/div&gt;
      &lt;/p&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  
  &lt;form action="quiz.html" class="container"&gt;
  &lt;div class="blank"&gt;
      &lt;p id="nine"&gt;9.&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;What is the capitol of Hawaii?&lt;br /&gt; 
          &lt;div class="tab"&gt; 
              &lt;input type="radio" name="question" value="A" /&gt;&amp;nbsp;Paris&lt;br /&gt;
              &lt;input type="radio" name="question" value="B" /&gt;&amp;nbsp;Honolulu&lt;br /&gt;
              &lt;input type="radio" name="question" value="C" /&gt;&amp;nbsp;Austin&lt;br /&gt;
              &lt;input type="radio" name="question" value="D" /&gt;&amp;nbsp;Cadilac&lt;br /&gt;
          &lt;/div&gt;
      &lt;/p&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  
  &lt;form action="quiz.html" class="container"&gt;
  &lt;div class="blank"&gt;
      &lt;p id="ten"&gt;10.&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;What is the capitol of Ohio?&lt;br /&gt;
          &lt;div class="tab"&gt;   
              &lt;input type="radio" name="question" value="A" /&gt;&amp;nbsp;Cleveland&lt;br /&gt;
              &lt;input type="radio" name="question" value="B" /&gt;&amp;nbsp;Green Bay&lt;br /&gt;
              &lt;input type="radio" name="question" value="C" /&gt;&amp;nbsp;Austin&lt;br /&gt;
              &lt;input type="radio" name="question" value="D" /&gt;&amp;nbsp;Columbus&lt;br /&gt;
          &lt;/div&gt;
      &lt;/p&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  
  &lt;div id="button"&gt;        
      &lt;input type="submit" value="submit" /&gt;
  &lt;/div&gt;
  
  
  &lt;/div&gt;
  
  &lt;/div&gt;
  
  &lt;/div&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Javascript:</p>
  
  <pre><code>$(document).ready(function(){
  
   $("#button").click(function(){
  
  var numQues= 10;
  var numChoices= 4;
  var answers = new Array(10);
  
  answers[0] = "Lansing";
  answers[1] = "Richmond";
  answers[2] = "Little Rock";
  answers[3] = "Pheonix";
  answers[4] = "Tallahassee";
  answers[5] = "Lincoln";
  answers[6] = "Austin";
  answers[7] = "Juneau";
  answers[8] = "Honolulu";
  answers[9] = "Columbus";
  
  function getScore(form){
      var score = 0;
      var currElt;
      var currSelection;
      for(i = 0; i&lt;numQues; i++){
          currElt = i * numChoi;
          for(j = 0; j&lt;numChoi; j++){
              currSelection = form.elements[currElt + j];
              if(currSelection.checked){
                  if(currSelection.value == answers[i]){
                  score++;
                  break;
                  }
              }
          }
      }
  
      score = math.round(score/numQues * 100);
      form.precentage.value = score + "&amp;#37;";
      var corrAnswers = "";
      for(i = 1; i &lt;numQues; i++){
          corrAnswers += i + "." + answers [i - 1] + "\r\n;"
      }
      form.solutions.value = corrAnswers/numQues * 100 + "%";}
  });
  });
  </code></pre>
  
  <p>One more addition: should I create another page for the score results or as of now how should it look?</p>
  
  <p>Thanks</p>