View Single Post
Old 01-24-2013, 01:13 PM   PM User | #14
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,102
Thanks: 197
Thanked 2,421 Times in 2,399 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
You code is still rotten with errors.

One more time: You changed all of the getElements to name'Ticket' without changing the corresponding input names/ids.
input Id="adult"

If you used Number() as I advised then 2+3 comes to 5, not 23 which is two string values concatenated. I don't think that the code you posted here is the same code as you are using to test.

To multiply the number of tickets by price simply do

var Adult = Number(document.getElementById('adultTicket').value) || 0;
var aduitprice = 10.50; // (no $ sign!!)
var adultcost = Adult * adultprice;

If desired add a $ sign to the total at the end before displaying the result.
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Philip M is offline   Reply With Quote