Check All | JavaScriptSource

Check All

Nannette Thacker Apr 28, 2000

General

Dynamically checks and unchecks all the checkboxes in a form when a button is clicked. Much easier than manually hard-coding the checkbox names.


Make a selection
Java
JavaScript
ASP
HTML
SQL

Notes

Source Code

Paste this source code into the designated areas.

External file

Paste this code into an external JavaScript file named: checkAll.js


Head

Paste this code into the HEAD section of your HTML document.


Body

Paste this code into the BODY section of your HTML document


Leave a Response

(7 comments)

Your question is beyond the scope of these comments. You will need to post it over on [a href="http://www.webdeveloper.com/forum/forumdisplay.php?f=3"]the JavaScript forum[/a]. Thanks!

Lee Jan 16, 2009

Robert,[br /][br /]There should be no reason why the method of processing the form would affect the usage of this script.

Lee Dec 2, 2008

Hi[br /][br /]I read your article but it like to know it is possibel to use this script for asp:checkboxlist.[br /][br /]pls send me details[br /][br /]Regards[br /]karan panchal

karan panchal Nov 21, 2008

The action attribut is empty. However, usually one will have a action with a form. But then those check/uncheck all buttons would behave falsely.[br /][br /]So what would be a better solution in this case?

robert Nov 19, 2008

Your question is beyond the scope of these comments. You will need to post it over on [a href="http://www.webdeveloper.com/forum/forumdisplay.php?f=3"]the JavaScript forum[/a]. Thanks!

Lee Nov 6, 2008