If those are the only checkboxes in a form you can do the following:

 

 

f

function selectAllCheckBox(actionForm){

 

            for ( i = 0; i < actionForm.elements.length; i++ ) {

                        if (actionForm.elements[i].type == 'checkbox' ) {

                       

                                    actionForm.elements[i].checked  = true; 

                       

                        }          

           

            }          

 

}

 

function clearAllCheckBox(actionForm){

           

            for ( i = 0; i < actionForm.elements.length; i++ ) {

                        if (actionForm.elements[i].type == 'checkbox' ) {

                       

                                    actionForm.elements[i].checked  = false;

                       

                        }          

           

            }          

 

}

 

 

function invertCheckBox(actionForm){

           

            for ( i = 0; i < actionForm.elements.length; i++ ) {

                        if (actionForm.elements[i].type == 'checkbox' ) {

                       

                                    if (actionForm.elements[i].checked == true) {

                                               

                                                actionForm.elements[i].checked  = false;

                                               

                                    }

                                    else {

                                   

                                                actionForm.elements[i].checked  = true; 

                                   

                                    }          

                       

                        }

                                   

           

            }          

 

}

 

-----Original Message-----
From: Emily Gu [mailto:[EMAIL PROTECTED]
Sent: Friday, January 06, 2006 5:04 PM
To: [email protected]
Subject: How to do _javascript_ select all and de-selected all for checkboxes in t:dataTable

 

Hi,

 

I am using <t:dataTable> to show the first column as the checkbox for each row. Is there a way to add "select all" and "de-select all" _javascript_ into these checkboxes? I don't want to go back to the server side to do such simple thing. Please shed some lights.

 

Thanks for your help!

Emily

Reply via email to