Go Back to JavaScript :: Dynamic Site Solutions

Using Checkboxes to Update a Total

This script works in IE5+/Win, Firefox, Netscape 6+, Opera 7+, Konqueror 3, Safari, IE5/Mac, and iCab 3. JSON is used to store the prices for the items, so that the value attribute of the checkboxes can be used for something else, e.g. a product identification number.

Demonstration

Options:

Note: To use this I recommend copying the code found in the <script> element found before the <form> element in this document and placing it in a ".js" file that you can call from your pages with something like <script type="text/javascript" src="checkboxTotal.js"></script>.

Last update: 2007-06-12