How to pass the html name of button group to a javascript function
<p>Say I have a function similar to this:  </p>

<pre><code>  function getGroupValue(group)
  {
     for (var i=0; i &lt; group.length; i++) 
     {
        if (group[i].checked) 
        {
           return group[i].value;
        }
     }
  }
</code></pre>

<p>that i can call with something like <code>getGroupValue(document.forms[0].myGroup)</code> </p>

<p>How do I convert this to just passing in the name of a html radio button group like 
<code>getGroupValue('myGroupName')</code> ?</p>
