Auto-Sum Form Boxes

Jim Stiles May 13, 2005

General

This script will automatically total boxes in a form. Use it to keep a running total of quantites or prices in an order form.


  
+
=

Notes

Source Code

Paste this source code into the designated areas.

External file

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


CSS

Paste this code into your external CSS file or in the <style> section within the HEAD section of your HTML document.


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

(25 comments)

thanks alot[br /]i was in need indeed for that scribt

moustafa Nov 13, 2008

Mark,[br /][br /]You would just need to add another variable to the calc() function (with a different name), and add it to the autoSumForm line. Then add another box in the form, using the same name you used in the calc() function.

Lee Nov 6, 2008

You can find a script for that [a href="http://javascript.internet.com/forms/auto-sum-checkboxes.html"]here[/a]

Lee Nov 6, 2008

You would add the "readonly" attribute to the input control, e.g.,[br /][br /]input class="right" readonly="readonly" type=text name="thirdBox"

Lee Oct 31, 2008

how about sum of 3 form boxes?

mark Oct 15, 2008