.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> Javascript >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Function uncheck the header checkbox.

Posted By:Maverick       Posted Date: March 24, 2011    Points: 25    Category: Javascript    URL: http://www.dotnetspark.com  

Function uncheck the header checkbox.
 

////Function uncheck the header checkbox.
function CheckChanged() {
    var frm = document.forms[0];
    var boolAllChecked;
    boolAllChecked = true;
    for (i = 0; i < frm.length; i++) {
        e = frm.elements[i];


        if (e.type == 'checkbox' && e.name.indexOf('chkCheckRow') != -1) {

            if (e.checked == false) {
                boolAllChecked = false;
                break;
            }
        }

    }
    for (i = 0; i < frm.length; i++) {
        e = frm.elements[i];
        if (e.type == 'checkbox' && e.name.indexOf('CheckAll') != -1) {
            if (boolAllChecked == false)
                e.checked = false;
            else
                e.checked = true;
            break;
        }
    }
}

Code



 

 
 
  OnClick="javascript:return CheckChanged();" />


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend