View Single Post
Old 01-23-2013, 06:49 PM   PM User | #8
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,044
Thanks: 197
Thanked 2,412 Times in 2,390 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Quote:
Originally Posted by andynov123 View Post
I moved the <script> and its contents and I went into error console in chrome but it's blank. I wasn't sure if I looked in the right place for the console so I took a screenshot in the image below of where I was.
A screenshot is no use whatsoever. Use your browser error console (F12).

You persistently use Id instead of id - Javascript is case sensitive. Id is meaningless to Javascript.

You also persistently use document.getElementbyId - again, Javascript is case sensitive.

onClick should be onclick.

You also use the same id for HTML elements and Javascript variables. Very unwise.

Use Number() to convert the string values entered by the user:-
var Adult = Number(document.getElementbyId('adult').value); // Javascript is case sensitive so Adult is not the same as adult
// etc.
var total = parseFloat(adult + child + senior + military + seniorday + studentday); // concatenates the 6 string values and converts to a real number. Use Number() to make the individual values numbers, and remove parseFloat(). In any case the number of tickets must be an integer, so parseFloat() makes no sense.


You have not specified the width and height of your image.

You have assigned the same name quantity to multiple variables.

May be other errors as well.


My advice would be to strip your code down to just one element to start with, test that and get it working before moving on.
__________________

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.

Last edited by Philip M; 01-23-2013 at 07:32 PM.. Reason: Noticed typo
Philip M is offline   Reply With Quote