Controlling Checkboxes with JavaScript
By Will Bontrager2005-06-29
Totaling the Value of Checked Checkboxes
The demonstration has checkboxes representing four items, with prices ranging from 0.00 to 55.00. There is also a text field. That text field is automatically updated with the total values of all checked checkboxes, every time one is checked or unchecked.
The JavaScript is TotalCheckedValues(). It does the following actions:
Scans each checkbox to determine whether or not it is checked,
Adds each checked value to a running total,
Formats the total into a currency decimal number, and
Displays the total in the form's text field.
Tutorial Pages:
» Controlling Checkboxes with JavaScript
» Limiting the Number of Checkboxes
» Totaling the Value of Checked Checkboxes
» Checking or Unchecking a Group of Checkboxes
» "All" and "None" Checkboxes
Copyright 2004 Bontrager Connection, LLC
