Wednesday, April 18, 2012

Checkbox List Select/Deselect using JavaScript

function Select(Select)
          {
            for (var n=0; n < document.forms[0].length; n++)
                if (document.forms[0].elements[n].type=='checkbox')
                    document.forms[0].elements[n].checked=Select;            
            return false;
           }

<a href="javascript:void(0)" style="font-weight: bold; text-decoration: none; color: Blue;"
                                                                        onclick="javascript:Select(true)">Check all</a> | <a href="javascript:void(0)" style="font-weight: bold;
                                                                            text-decoration: none; color: Blue;" onclick="javascript:Select(false)">Un-check
                                                                            all</a>

No comments:

Post a Comment