Auto-Sum Form Boxes | JavaScriptSource

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

(26 comments)

I think this script is broken; i tried it in Chrome and it doesn't work. (Maybe in the past?)

Tim Jul 27, 2013

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