Checkbox Changer | JavaScriptSource

Checkbox Changer

JavaScriptSource Staff Jul 27, 1999

General

This script takes a series of known named checkboxes and checks or uncheck them all at once. It can even change each checkbox to the opposite checked or not checked value. Clever for loops.


C1
C2
C3
C4
C5
C6
C7
C8
C9
C10
C11
C12
C13
C14




Notes

  • Posted: July 27, 1999

Source Code

Paste this source code into the designated areas.

External file

Paste this code into an external JavaScript file named: checkboxChanger.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

(4 comments)

You will need to submit your question to the [a href="http://www.webdeveloper.com/forum/forumdisplay.php?f=3"]JavaScript forums[/a].

Lee May 12, 2008

You will need to submit your question to the [a href="http://www.webdeveloper.com/forum/forumdisplay.php?f=3"]JavaScript forums[/a].

Lee May 12, 2008

i take a check box name as pf_app and type text field is another one that is pf_rate. If i click check box put tick then enter to the pf_rate. otherwise. if i check not to tick. then pf_rate is erase. how to can i writ ein client side validation

kamesh Dec 15, 2007

I'm not sure what I have incorrect here - but I get box is undefined or null.[br /][br /]Function:[br /]function JavaUpdate(reckey){[br /]// alert(reckey);[br /] box=eval("document.quarterly.approved");[br /] alert(box);[br /]// if (box.checked == true) {[br /]// var approval='Y';[br /]// alert(approved);[br /]// }[br /] window.location="quarterly_rpt.php.1?a=update&recid="+reckey";[br /]}[br /][br /]<form name=quarterly>[br /]<td class="<? echo $style ?>"><input type="checkbox" name="approved" checked onClick="JavaUpdate('<? echo $row&#91;"MYKEY"&#93; ?>')"> Approved </td>[br /]<? }else{ ?>[br /]</form>[br /][br /]If the approved box is checked I update the record on the DB. This code is inside a php/html page.[br /][br /]Thanks,[br /]Michelle

Michelle Dec 4, 2007