title: Multiple choice quiz - issue with radio buttons and functions
body: <p>I'm trying to create a multiple choice quiz using simple functions and radio buttons in the HTML form tags but it is only allowing me to check one radio button for the whole quiz instead of one per question.</p>
  
  <p>Also, the submit button is not activating the function <code>checkAll</code>, I don't know if this is because I am trying to do something impossible or simple because I'm just missing something. Any help would be appreciated! </p>
  
  <p>The code is below. . . I'm only new to JavasScript and html as well as StackOverflow, so sorry if I'm doing anything wrong with this question.</p>
  
  <pre><code>&lt;head&gt;
  &lt;script language="javascript"&gt;
  var score=0;
  
  function checkAll() {
  
  function questioncheckOne(){
      var correctAnswer = document.getElementById("a3")
      if (correctAnswer.checked == true) {
          score++;
          alert("Correct, your score is now " +score)
      }
      else {
              alert("Wrong, your score is now " +score)
      }
  };
  
  
  function questioncheckTwo(){
      var correctAnswer = document.getElementById("b2")
      if (correctAnswer.checked == true) {
          score++;
          alert("Correct, your score is now " +score)
      }
      else {
              alert("Wrong, your score is now " +score)
      }
  };
  
  
  function questioncheckThree(){
      var correctAnswer = document.getElementById("c4")
      if (correctAnswer.checked == true) {
          score++;
          alert("Correct, your score is now " +score)
      }
      else {
              alert("Wrong, your score is now " +score)
      }
  };
  
  
  function questioncheckFour(){
      var correctAnswer = document.getElementById("d3")
      if (correctAnswer.checked == true) {
          score++;
          alert("Correct, your score is now " +score)
      }
      else {
              alert("Wrong, your score is now " +score)
      }
  };
  
  
  function questioncheckFive(){
      var correctAnswer = document.getElementById("e3")
      if (correctAnswer.checked == true) {
          score++;
          alert("Correct, your score is now " +score)
      }
      else {
              alert("Wrong, your score is now " +score)
      }
  };
  
  };
  &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;form name ="Where in the world is...?"&gt;
  
  &lt;p&gt;
  
      Question1: Where in the world would you find the Spire? 
  
  &lt;/p&gt; 
  
  &lt;input type="radio" name="radio" id="a1" value="a1"  /&gt; Kerry. &lt;/input&gt;
  &lt;input type="radio" name="radio" id="a2" value="a1"  /&gt; Galway. &lt;/input&gt;
  &lt;input type="radio" name="radio" id="a3" value="a1"  /&gt; Dublin. &lt;/input&gt;
  &lt;input type="radio" name="radio" id="a4" value="a1"  /&gt; Donegal. &lt;/input&gt;
  
  
  &lt;p&gt; 
  
  
      Question2: Where in the world would you find the Colosseum? 
  
  &lt;/p&gt; 
  
  
  &lt;input type="radio" name="radio" id="b1" value="a2"  /&gt; Taipei. &lt;/input&gt;
  &lt;input type="radio" name="radio" id="b2" value="a2"  /&gt; Rome. &lt;/input&gt;
  &lt;input type="radio" name="radio" id="b3" value="a2"  /&gt; Reykjavic. &lt;/input&gt;
  &lt;input type="radio" name="radio" id="b4" value="a2"  /&gt; Brussels. &lt;/input&gt;
  
  
  &lt;p&gt; 
  
      Question3: Where in the world would you find the Taj Mahal? 
  
  &lt;/p&gt; 
  
  
  &lt;input type="radio" name="radio" id="c1" value="a3"  /&gt; London. &lt;/input&gt;
  &lt;input type="radio" name="radio" id="c2" value="a3"  /&gt; Brisbane. &lt;/input&gt;
  &lt;input type="radio" name="radio" id="c3" value="a3"  /&gt; Paris. &lt;/input&gt;
  &lt;input type="radio" name="radio" id="c4" value="a3"  /&gt; Agra. &lt;/input&gt;
  
  
  &lt;p&gt; 
  
      Question4: Where in the world would you find the Parthenon? 
  
  &lt;/p&gt; 
  
  
  &lt;input type="radio" name="radio" id="d1" value="a4"  /&gt; Edinburgh. &lt;/input&gt;
  &lt;input type="radio" name="radio" id="d2" value="a4"  /&gt; Oslo. &lt;/input&gt;
  &lt;input type="radio" name="radio" id="d3" value="a4"  /&gt; Athens. &lt;/input&gt;
  &lt;input type="radio" name="radio" id="d4" value="a4"  /&gt; Pyongyang. &lt;/input&gt;
  
  
  &lt;p&gt; 
  
  
  
      Question5: Where in the world would you find the Niagara Falls? 
  
  &lt;/p&gt;
  
  
  &lt;input type="radio" name="radio" id="e1" value="a5"  /&gt; Hong Kong. &lt;/input&gt;
  &lt;input type="radio" name="radio" id="e2" value="a5"  /&gt; Moscow. &lt;/input&gt;
  &lt;input type="radio" name="radio" id="e3" value="a5"  /&gt; New York. &lt;/input&gt;
  &lt;input type="radio" name="radio" id="e4" value="a5"  /&gt; Ottawa. &lt;/input&gt;
  
  
  
  &lt;p&gt;
  
  &lt;input type="button" name="submit" id="submit" value="submit" onclick="checkAll()"  /&gt; &lt;/input&gt;
  
  &lt;/p&gt;
  
  
  &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>