<script>
function check()
{
o = document.getElementsByName("a");
count = 0;
for(c=0; c<o.length; c++)
{
if(o[c].checked) count++;
}
return count>1;
}
</script>
<form onsubmit="return check()">
<input type="checkbox" name="a" value="1">1
<input type="checkbox" name="a" value="2">2
<input type="checkbox" name="a" value="3">3
<input type="submit">
</form>

解决方案 »

  1.   

    count = 0;
    for(c=0; c<o.length; c++)
    {
    if(o[c].checked) count++;
    }
    return count>1;
    \如果这段看不懂.建议你先去学点基础的东西.再来写代码吧.....
      

  2.   

    <script>
    function check()
    {
    o = document.getElementsByName("a");
    count = 0;
    for(c=0; c<o.length; c++)
    {
    if(o[c].checked) count++;
    }
             if(count<10)
             {
                      alert("少于10");
                      return false;
             }}
    </script>
    <form onsubmit="return check()">
    <input type="checkbox" name="a" value="1">1
    <input type="checkbox" name="a" value="2">2
    <input type="checkbox" name="a" value="3">3
    <input type="submit">
    </form>
      

  3.   

    <script>
    function check()
    {
    o = document.getElementsByTagName("input");
    count = 0;
    for(c=0; c<o.length; c++)
    {
    if(o[c].type=="checkbox" && o[c].checked) count++;
    }
    if(count < 2)
    {
    alert("少于10");
    return false;
    }
    }
    </script>
    <form onsubmit="return check()">
    <input type="checkbox" name="a" value="1">1
    <input type="checkbox" name="b" value="2">2
    <input type="checkbox" name="c" value="3">3
    <input type="submit">
    </form>
      

  4.   

    if(count < 2)
    改成
    if(count < 10)