The adult fare is $120 and the child fare is $90 I would like when u select 2 adults it auto calculates $240 in to Total Adult fare box and same for the child.
Then the total adults and total children coloumn to auto calculate and give the total fares..
Can that be done? Or if u have a easier way let me know..
@mercury7Sep 29.2004 — #Go to http://vivxdesign.com/template/tickets.htm . There you'll see a different implementation of what you're talking about. I think it's a better one though. I didn't complete the program for you; you'll still need to add the calendar functionality to it, but it should get you more than started. Go view>source to see how I did it.
@icebabyauthorSep 29.2004 — #thanks for feeling charitable.. I have one other question if u want another set of addition on that same page what do u have to do..
@mercury7Sep 30.2004 — #Here's a new function with tax functionality. You need to change the id and name of your form element, "Fuel Charge", to "fuelCharge". JavaScript uses one-word names. If you have any other fees, then just add more lines of script and add them to the total.
[code=php] </style> <script type="text/javascript"> var total=0; var tax=.10; //Set tax amount 10% = .10 var taxAmount; function addTotal(type, number){ if (number!="How many travelling?"){ number=parseInt(number); if (type==1) total=total+(120*number); else if (type==2) total=total+(90*number); else alert("something wrong!"); taxAmount=total*tax; //calculate tax document.form1.fuelCharge.value=taxAmount; //report total=taxAmount+total; //add tax to total document.form1.totalcost.value=total; //report total } else {alert("Please enter a valid nuber of tickets!nThen, selcet your ticket type.");} } </script> [/code]
@mercury7Sep 30.2004 — #Do you understand the code?
I told you in the other post that you have to change the name of one of your textboxes. I also did not add the code for a fixed fee. I thought you could handle that. If you want a fixed fee, then just add whatever the amount is to the total