<form action=".." method="post" onsubmit="return checks();">    
    <input type="radio" name="Question1" id="radio1" value="A" /> A.2 
        <input type="radio" name="Question1" id="radio2" value="B" /> B.3  
        <input type="radio" name="Question1" id="radio3" value="C" /> C.4  
        <input type="radio" name="Question1" id="radio4" value="D" /> D.5 
      
        <input type="radio" name="Question2" id="radio5" value="A" /> A.2 
        <input type="radio" name="Question2" id="radio6" value="B" /> B.3  
        <input type="radio" name="Question2" id="radio7" value="C" /> C.4  
        <input type="radio" name="Question2" id="radio8" value="D" /> D.5 
      
       ......................</form>
  function checks()
        {
            for(i=0;i<2;i++)    
            {
               alert(document.getElementById("radio" + i).checked);
            }
            return false;
        }这是一个大概的方法。具体得改进。

解决方案 »

  1.   

    function checks(){
        checkres = true;
        for (j=1;j<=10;j++){
            if (!checkone("Question"+j)){
                checkres = false;
                return false;
            }
        }
    }function checkone(objname){
        var objs = document.getElementsByName(objname);
        res = false;
        for (i=0;i<objs.lenght;i++){
            if (objs[i].checked){
                 res = true;
                 break;
            }
        }
        return res;
    }