<script language="Javascript"><!--
function click1(){
  for (var i = 0; i<document.getElementsByName("m031").length;i++){
     if (!document.getElementsByName("m031")[i].ckecked){
        alert("请选中公司类别!");
        theForm.m031.focus();
        return(false);
        }
     }
 }
// --></script>
<span id=A ></span>
<input type=ckeckbox name="m031"><br>
<input type=ckeckbox name="m031"><br>
<input type=ckeckbox name="m031"><br>
<input type=ckeckbox name="m031"><br>
<input type=ckeckbox name="m031"><br>
<input type=ckeckbox name="m031"><br>
<input type=ckeckbox name="m031"><br>
<input type=button onclick="click1()" value=check><br>

解决方案 »

  1.   


    <HTML><HEAD>
    <META content="text/html; charset=gb2312" http-equiv=Content-Type>
    <script language="Javascript">
    <!--
    function clickForm(){
      if(document.frmInfo.m031_99.value=="") {alert("请填写m031_99");document.frmInfo.m031_99.focus();return(false);}
      for (var i=0;i<document.frmInfo.m031.length-1;i++){
         if (!document.frmInfo.m031[i].checked) {
            alert("请选中公司类别!");
            document.frmInfo.m031[i].focus();
            return(false);
            }
         }
      return(true);
     }
    -->
    </script>
    <BODY>
    <Form name=frmInfo>
    <INPUT name=m031 type=checkbox>
    <INPUT name=m031 type=checkbox>
    <INPUT name=m031 type=checkbox>
    <INPUT name=m031 type=checkbox>
    <INPUT name=m031 type=checkbox>
    <INPUT name=m031 type=checkbox>
    <INPUT name=m031 type=checkbox>
    <INPUT name=m031 type=checkbox>
    <input name=m031_99>
    <button onclick="clickForm()">check</button>
    <br>
    </form>
    </BODY>
    </HTML>