<script language=javascript>
function xxx()
{
         alert(document.f1.id1.value)
         alert(document.f1.id2.value)
}
</script><form name="f1">
<input type=Radio value=1 name="id1" onblur="xxx()">
<input type=Radio value=2 name="id2" onblur="xxx()"></form>

解决方案 »

  1.   


    <form name="f1">
    <input type=Radio value=1 name="r">
    <input type=Radio value=2 name="r"></form><script language=javascript>
             alert(document.f1.r[0].value)
             alert(document.f1.r[1].value)
    </script>
      

  2.   

    <html>
    <head>
    <script language="javascript">
    function checkvalue() {
        if (r[0].checked) {
            alert("Radio " + r[0].value + " checked.");
        }
        if (r[1].checked) {
            alert("Radio " + r[1].value + " checked.");
        }
    }
    function checkvalue_f() {
        if (r[0].checked) {
            alert("Radio " + f.r[0].value + " checked.");
        }
        if (r[1].checked) {
            alert("Radio " + f.r[1].value + " checked.");
        }
    }
    </script>
    </head>
    <body><input type="radio" name="r" value="One" checked="true"/>One
    <input type="radio" name="r" value="Two"/>Two
    <input type="button" value="Check" onclick="checkvalue();"/>
    <br/><form name="f">
    <input type="radio" name="r" value="One" checked="true"/>One
    <input type="radio" name="r" value="Two"/>Two
    <input type="button" value="Form Check" onclick="checkvalue_f();"/>
    </form></body>
    </html>