Friday, February 14, 2020

Select all checkbox example in Javascript

<html>
 <head>
  <script type="text/javascript">function CheckUncheckAll(){
   var  selectAllCheckbox=document.getElementById("checkUncheckAll");
   if(selectAllCheckbox.checked==true){
    var checkboxes =  document.getElementsByName("rowSelectCheckBox");
     for(var i=0n=checkboxes.length;i<n;i++) {
      checkboxes[i].checked = true;
     }
    }else {
     var checkboxes =  document.getElementsByName("rowSelectCheckBox");
     for(var i=0n=checkboxes.length;i<n;i++) {
      checkboxes[i].checked = false;
     }
    }
   }</script>
  </head>
 <body>
  <form id="form1" action="dummyAction" method="get">
   <table colspan="2" width="500" border="1" align="left" cellpadding="0" cellspacing="0">
    <tr bgcolor="#ABB">
     <td><input type="checkbox" id="checkUncheckAll" onClick="CheckUncheckAll()"/></td><td >Employee Name</td>
    </tr>
    <tr>
     <td><input type="checkbox" name="rowSelectCheckBox" value="1" onClick="CheckUncheckAll()"/></td><td>John Doe</td>
    </tr>
    <tr>
     <td><input type="checkbox" name="rowSelectCheckBox" value="2" onClick="CheckUncheckAll()"/></td><td>Mr Black</td>
    </tr>
   </table>
  </form>
 </body>
</html>

1 comment:

  1. Strange "water hack" burns 2 lbs overnight

    At least 160 000 women and men are hacking their diet with a easy and secret "water hack" to drop 2 lbs every night as they sleep.

    It is very easy and works every time.

    This is how you can do it yourself:

    1) Take a clear glass and fill it up with water half the way

    2) And now follow this proven hack

    and become 2 lbs thinner the next day!

    ReplyDelete