Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 JavaScript: Toggle All Checkboxes on or off Jump to:  
Category: >> JavaScript >> Toggle All Checkboxes on or off Bookmark and Share

<< lastnext >>

Snippet Name: Toggle All Checkboxes on or off

Description: Simple Javascript snippet that lets you toggle a group of checkboxes on or off at the same time. This is the format for your HTML form.

Comment: (none)

Language: JAVASCRIPT
Highlight Mode: JAVASCRIPT
Last Modified: March 01st, 2009

FUNCTION toggleAll(id){
     box = document.getElementById(id);
 
     IF(box.checked == TRUE)
     {
          VAR setting = TRUE;
     }
     ELSE
     {
          VAR setting = FALSE;
     }
 
     VAR cur_id = id+'1';
 
     VAR count = 1;
     WHILE(box = document.getElementById(cur_id))
     {
          box.checked = setting;
          cur_id = id+count;
          count++;
     }
}
 
<input type=checkbox id='toggleall' onClick="toggleAll('myform');"> Toggle All
 
<input type=checkbox id='myform1'>
<input type=checkbox id='myform2'>
<input type=checkbox id='myform3'>


Free
Oracle Magazine
Subscriptions
and Oracle White Papers


SQL University.net courses meet the most demanding needs of the business world for advanced education in a cost-effective manner. SQL University.net courses are available immediately for IT professionals and can be taken without disruption of your workplace schedule or processes.

Compared to traditional travel-based training, SQL University.net saves time and valuable corporate resources, allowing companies to do more with less. That's our mission, and that's what we deliver.

Click here to find out more
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 106 users online    © 2009 psoug.org

PSOUG LOGIN
Username: 
Password: 
Forgot your password?