Feed Rss
Feb 27 2008
category: Javascript & AJAX,Tutorials author: lotsofcode
This is a very basic JavaScript code to calculate the value of form elements.
It can become quite useful when wanting to add items up on the fly if you prefer not to use ajax or you do not have a server side scripting language available.
tag: Javascript
Hey,
Great code you have. I was trying to get it working with other form fields that dont get added up but it seems to break your code.
Is there a way I can add additional fields... like for a name, to the form without breaking the calculation?
Thank you for your time.
Robert
I tried your code but my total is always "NaN"
in the end of for (var f = 0; f < userInputs.length; f++){
add fields[f] = 0;
great script, helps to understand how it works
Name (required)
Mail (will not be published) (required)
Website
Comment text
Hey,
Great code you have. I was trying to get it working with other form fields that dont get added up but it seems to break your code.
Is there a way I can add additional fields... like for a name, to the form without breaking the calculation?
Thank you for your time.
Robert
I tried your code but my total is always "NaN"
in the end of for (var f = 0; f < userInputs.length; f++){
add fields[f] = 0;
great script, helps to understand how it works