title: Getting the selected radio without using "Id" but "name"
body: <p>I was trying to get selected radio button by using "document.getElementByName('nameOfradio')" because all of the radio buttons share the same name. But, nothing happened. I tried the same thing with document.getElementById('nameOfradio') and worked well.However, I had to give unique id for all of the radio buttons. So that, it turns ugly when i have 20 radio buttons. As a result, what I wanted is making a shortcut. How can i get the value of selected radio button by using their "name"? Codes; </p>
  
  <p><strong>Html</strong></p>
  
  <pre><code>&lt;input type="radio" name="nameOfradio" value="onm1" /&gt; 1
  &lt;input type="radio" name="nameOfradio" value="onm2" /&gt; 2
  
  &lt;input type='button' onclick='radio3()' value='Submit' /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>Ajax(relavant part of radio3())</strong></p>
  
  <pre><code>var radioPushed = document.getElementByName('nameOfradio').value;
  
  var queryString = "?radioPushed=" + radioPushed;//to send the value to another file
  ajaxRequest.open("GET", "radio_display.php" + queryString, true);
  ajaxRequest.send(null);
  </code></pre>
  
  <p>As i said document.getElementById worked but it requires too much work:( How can i make it simplier by using common feature of radio buttons, instead of giving them unique id? A short explanation why i could not make it would be very helpful(new in javascript and ajax)</p>