<input type=checkbox><input type=checkbox><input type=checkbox><input type=checkbox>
<input type=checkbox><input type=checkbox><input type=checkbox><input type=checkbox> 
<input type=button value="Check All" onclick="mm()"> <script language=javascript> 
function mm()
{
   var a = document.getElementsByTagName("input");
   if(a[0].checked==true){
   for (var i=0; i<a.length; i++)
      if (a[i].type == "checkbox") a[i].checked = false;
   }
   else
   {
   for (var i=0; i<a.length; i++)
      if (a[i].type == "checkbox") a[i].checked = true;
   }
}
</script>

解决方案 »

  1.   

    fason(阿信) :
          你好!
          谢谢你,几次遇上问题都多亏你的帮助!真的谢谢你!
      

  2.   

    <input type=checkbox><input type=checkbox><input type=checkbox><input type=checkbox>
    <input type=checkbox><input type=checkbox><input type=checkbox><input type=checkbox> 
    全选<input type=checkbox value="Check All" onclick="mm(this)"> <script language=javascript> 
    function mm(o)
    {
       var a = document.getElementsByTagName("input");
       for (var i=0; i<a.length; i++){
          if (a[i].type == "checkbox") a[i].checked = o.checked;
       }
       
    }
    </script>
      

  3.   

    <form name=aa>
    <input type=checkbox><input type=checkbox><input type=checkbox><input type=checkbox><input type=checkbox><input type=checkbox><input type=checkbox><input type=checkbox><input type=checkbox><input type=checkbox><input type=checkbox><input type=checkbox><input type=checkbox><input type=checkbox><input type=checkbox>
    </form>
    <button onclick="checkall()">全选</button>
    <script>
    function checkall()
     {for(i=0;i<aa.elements.length;i++)
        if(aa.elements[i].type=="checkbox")
          aa.elements[i].checked=1
      }
    </script>
      

  4.   

    function allselect()
    {
    for(i=0;i<document.form1.elements.length-1;i++)
    document.form1.elements(i).checked=true;
    }
      

  5.   

    xinyunyishui(心云意水) :
        也感谢你的回答,这次没能给你分,实在抱歉!
    以后有机会,定当把这次的分数补上!