<script language="javascript">
         function CheckAllCheckboxes()
    {
      var d=document.getElementById("GridView1").getElementsByTagName("input");
     
      for (var i=0;i<d.length;i++)
                {
                if(d[i].type=="checkbox")
                {
                d[i].checked=!d[i].checked;
                }
             
              
               }

    }
    </script>
<asp:TemplateField HeaderText="全选&lt;input type=checkbox id='ChAll' onclick='CheckAllCheckboxes()'/&gt;">
               <ItemTemplate>
               <asp:CheckBox runat="server" ID="CheckBox1" />
               </ItemTemplate>

 function CheckAll(objControl)
    {
          var element;
          var i = 0;
          var isCheck;
      
      
          for(var i=0;i<document.getElementById(objControl).getElementsByTagName("input").length;i++)
         {
            var dd=objControl+"_"+i;
            document.getElementById(dd).checked = !document.getElementById(dd).checked;
         }


    }

posted on 2010-05-06 18:41  秦威龙  阅读(614)  评论(0编辑  收藏  举报