JAVACSCRIPTがINPUT値を参照する問題


2組のINPUT値があり、A 01、A 02、以下の通りである.






2つの値のうちの1つの属性がCHECKEDである場合、TRUEに戻ります.そうでない場合、FALSEに戻ります.
JAVASSCRIPTでどう書きますか?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<head>
<title>     </title>
<script>
function checkRadio(){
    var flag = false;
    var radios = document.getElementsByName("A01");
    for(var i = 0; i < radios.length && !flag; i++){
        flag = flag || radios[i].checked;
    }

    radios = document.getElementsByName("A02");
    for(var i = 0; i < radios.length && !flag; i++){
        flag = flag || radios[i].checked;
    }
    return flag;
}
</script>
</head>

<body>
<form>
<input name="A01"  value="FD"  type="radio"/> 
<input name="A01"  value="ERERER"  type="radio"/> 
<input name="A01"  value="HGHGHGH"  type="radio"/> 


<input name="A02"  value="FD"  type="radio"/> 
<input name="A02"  value="ERERER"  type="radio"/> 
<input name="A02"  value="HGHGHGH"  type="radio"/>

<input type="button" value="  " onclick="alert(checkRadio())"/>
<input type="reset" value="  ">
</form>
</body>
</html>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb_23-12" />
<title>     </title>
<script>
function chkRadio(n)
{//    
    var o = document.getElementsByName(n);
    for(var i = 0;i < o.length;i++) if(o[i].checked) return true
    return false;
}

function withTow()
{//    
    alert(chkRadio("A01") && chkRadio("A02"));
}
</script>
</head>

<body>
<input name="A01"  value="FD"  type="radio"> 
<input name="A01"  value="ERERER"  type="radio"> 
<input name="A01"  value="HGHGHGH"  type="radio"> 
<input type="button" value="  A01" onclick="alert(chkRadio('A01'))"> 

<input name="A02"  value="FD"  type="radio"> 
<input name="A02"  value="ERERER"  type="radio"> 
<input name="A02"  value="HGHGHGH"  type="radio"> 
<input type="button" value="  A02" onclick="alert(chkRadio('A02'))"> <br><br>

<input type="button" value="    " onclick="withTow()"> 

</body>
</html>