Hi i want to need javascript using datagrid, for example i have a datagrid and in datagrid above two check boxes 1)checked and 2) unchecked .In datagrid also 5 checkboxes is there ,if i clicked checked all checkboxes will select and if i'll clicked unchecked all unselect checkboxes will select ple any one help me (for examlple yahoo mail if we'll select button all will select like this )

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE> New Document </TITLE>
  <META NAME="Generator" CONTENT="">
  <META NAME="Author" CONTENT="">
  <META NAME="Keywords" CONTENT="">
  <META NAME="Description" CONTENT="">
  <script type="text/javascript">
      function checkAll(theElement) {
     var theForm = theElement.form, z = 0;
     for(z=0; z<theForm.length;z++){
      if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall'){
      theForm[z].checked = theElement.checked;
      }
     }
    }
 </script>
 </HEAD>
 <BODY>
<form><input type="checkbox" name="check1"/>
<br/>
<input type="checkbox" name="check2"/>
<br/>
<input type="checkbox" name="check3"/>
<br/>
<input type="checkbox" name="check4"/>
<br/>
<input type="checkbox" name="check5"/>
<br/>
<input type="checkbox" name="checkall" onclick="checkAll(this);"/>Check All
<input type="checkbox" name="checkall" onclick="checkAll(this);"/>Uncheck All</form>
</BODY>
</HTML>

I HOPE THIS MAY HELP YOU

Edited 3 Years Ago by mike_2000_17: Fixed formatting

This article has been dead for over six months. Start a new discussion instead.