Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Online Calculations

Status
Not open for further replies.

mdr227

Programmer
Nov 17, 2000
114
US
I have a simple event registration form with an input box for quantity attending
(name = "txtQuantity1", "txtQuantity2", etc.) each event and an amount for each event (name = "txtAmount1", "txtAmount2", etc.). There is another text box for total amount per event (name = "txtTotal1", "txtTotal2", etc.). What I want to be able to do is to automatically have the total per event be calculated, along with a running overall total, as a user enters in a quantitiy attending. For example, event1 costs $25 and once a user enters in a quantity of 3 then I want the "txtTotal1" text box to display $75 and the "txtOverallTotal" box to display $75 as well. This "txtOverallTotal" will be updated each time another event is selected. My question is how to do this using Javascript. Thank you for any help.
 
You can access the form field's values like so, where formname is the name of the form they are contained in:

document.formname.fieldname.value

The rst of your calculations can be completed using the standard mathmateical operators (*,/,+,-) jaredn@subdimension.com -
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top