<INPUT type="radio" value="1" name="b">1
<INPUT type="radio" value="2" name="b">2
<INPUT type="radio" value="3" name="b">3
<INPUT type="button" value="Button" onclick="aa()">

<script language="javascript">
function aa()
{
var a=document.getElementsByName("b");
for (var i=0; i<a.length; i++) {
a[i].checked?alert(a[i].value):'';
}
}
</script>

解决方案 »

  1.   

    <INPUT type="radio" value="1" id="b1" name="b">1
    <INPUT type="radio" value="2" id="b2" name="b">2
    <INPUT type="radio" value="3" id="b3" name="b">3
    <INPUT type="button" value="Button" onclick="aa()">

    <script language="javascript">
    function aa()
    {
        alert(document.getElementById('b1').value);
    }
    </script>
      

  2.   

    一楼正解!
    楼主还有要注意一点,控件里面命名name的值是就用document.getElementsByName();而命名id值的话就使用document.getElementById().