<input type=radio name=a>
<input type=radio name=a>
<input type=radio name=a>
<input type=radio name=a>
<input type=button onclick="check()">
<script>
function check(){
var n=0,s
var ra=document.getElementsByName("a")
for(i=0;i<ra.length;i++)if(ra[i].checked){n++;s=i}
if(n==0)alert('你没有选')
else alert('选取了'+s+'个')
}
</script>

解决方案 »

  1.   

    选择了哪一个Radio
    <HTML><script language="vbscript">
    function checkme()
      for each ob in radio1
        if ob.checked then window.alert ob.value
      next
    end function
    </script><BODY>
    <INPUT name="radio1" type="radio" value="style" checked>Style
    <INPUT name="radio1" type="radio" value="barcode">Barcode
    <INPUT type="button" value="check" onclick="checkme()">
    </BODY></HTML>