Navigation Menu

Site Contents
What's New?


Site FAQ
About JSS
JavaScript Forum
JavaScript Tutorial
Friends of JSS

Link to Us
JavaScript Help
Contribute a script
Technology Jobs

Become a Partner

Internet.commerce

Partner With Us
Business Liability
Prepaid Phone Card
Promotional Golf
Promos and Premiums
Televisions
Online Shopping
Desktop Computers
Promotional Pens
KVM over IP
Shop Online
Promotional Items
Memory Upgrades
Online Education
KVM Switches

Internet.com

IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

Developer Channel

FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

Great Sites

DocJavaScript.com
dhtml.com
The Freebie Directory
TheFreeSite.com

Browse Doc JS's Tips!


Hiermenus Central


Promotions

Free Announcements


Social Bookmark

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


User Comments

Add a comment, suggestion, or correction
[For questions about usage, consult the Notes tab above or visit the JavaScript forum]

    
   
       
[optional field]
 
[optional field]

   

Comments feed Comment Feed RSS 2.0

18. From: jamadagni
05/25/2008 06:44:26

good..thx

15. From: Teri Mobley
Code "enhancement"
05/22/2008 13:38:28

I love this script! It was exactly what I needed. However I modified the script to accomodate 3 different sections of my form, with 10 boxes in each section and 10 separate totals. how can I share it with the forum and/or original author?

16. From: Lee (Admin)
06/26/2008 11:46:24

Thanks! You can submit it to me at our JavaScript submission page.

17. From: Kamon
04/11/2008 01:20:11

Excelente example. I was having trouble suming two values and now I can get it working even "in real time". Thanks!!!!

14. From: untoro
great
02/27/2008 10:09:46

geat script . thx

12. From: diana
multiple sums
01/22/2008 08:18:03

What code would you use to mutiple the the third box by $3.50 to get the subtotal for a fourth box? The fourth box I want to use to get the subtotal for the order. Any help would be appreciated! Thanks. Diana

13. From: Lee (Admin)
05/12/2008 11:53:04

You will need to submit your question to the JavaScript forums.

10. From: diana
need help with auto sum
01/15/2008 09:48:41

I am trying to auto sum the just the cookies fields in the form... can you help me. For instance if a person bought 2 samoas and 1 thin mint I want a field under the cookies that says 3 Total then next to that multiple by 3.50 so the next field say $10.50 Total Amount

Can you help me with the code?

11. From: Lee Underwood (Admin)
01/29/2008 12:48:38

Due to the limitations of these comments, you will need to submit your question to the JavaScript Forum for further help.

8. From: Kaushik
Multiple textBoxes
12/18/2007 04:24:32

The code is great. But if I want to apply the same feature through datagrid textboxes. Means I have a datagrid with textboxes. I want the sum of all the textboxes to calculate automatically like in the example. I have tried but it is going into a loop and going on adding the same value to the total. How to go about this.

next comments...

Do you write JavaScripts?
If you do, why not submit them to us?
We'll give you credit and a link back to your Web site.