title: Selecting Multiple Radio Buttons With Alert
body: <p>Basically, I want create a page that has a quiz like structure and the user can select one option from one question and another from another question. Depending on the answers to each question it would need to alert a certain output. I only have some basic knowledge of Javascript so am using the same theory of using text boxes to select an answer but this time I want to use Radio buttons. </p>
  
  <p>This is the HTML code for the page with the radio buttons:</p>
  
  <pre><code>&lt;p&gt;
                  &lt;strong&gt;1. This is the first question?&lt;/strong&gt;&lt;br /&gt;
                  &lt;input type="radio" name="op1" value="anw1"&gt;Option 1&lt;br&gt;
                  &lt;input type="radio" name="op1" value="anw2"&gt;Option 2
              &lt;/p&gt;
  
              &lt;p&gt;
                  &lt;strong&gt;2. This is the second question?&lt;/strong&gt;&lt;br /&gt;
  
                  &lt;input type="radio" name="op2" value="anw1"&gt;Option 1&lt;br&gt;
                  &lt;input type="radio" name="op2" value="anw2"&gt;Option 2
  
              &lt;/p&gt;
  
              &lt;input type='button' value='Get result!' onClick='Submit()' /&gt;&lt;br /&gt;
  </code></pre>
  
  <p>I then have the function for now in the head tag like this:</p>
  
  <pre><code>function Submit()
    {
  
  var op1 = document.getElementsByName('op1')
  var op2 = document.getElementsByName('op2')
  
  
  if(op1== "anw1" &amp;&amp; op2== "anw1")
  {
  alert ("This would be if both options one were selected")
  }
  
  else if (op1== "anw2"&amp;&amp; op2== "anw2")
  {
  alert ("This would be if the the seconds ones were selected")
  }
  
  else
  {
  
  alert ("This would be if neither were true")
  
  }
  
  }
  </code></pre>
  
  <p>However, I cannot seem to get to work so I think I might be not going about this the right way though I do want it set out similar . i can get the else part to work but none of the other ones.</p>