Hello, I have been watching this forum for some time now, but this is the first time I've ever needed to post a question, because I don't think there is the same question anywhere else. Maybe I just can't find it. Anyway, here is my code. I can not get my value to display into the text input. I'm not sure if it adds or not, however. Hopefully, someone can point out what I did wrong. This is for a fake store for a project I have in school.
I know it has to be something stupid that I did wrong, so I would appreciate any help that is given. I am about ready to cry. Patrick [ December 11, 2003: Message edited by: Patrick Kenyon ]
onChange='showTotal' should be onChange='showTotal()'
Joined: Nov 08, 2001
You actually have a lot more problems then that -Your function does not have a ending } -You are using the word form instead of inputForm in all of your checkbox validations -You do not need to update the text field with the total each time you are in an if statement since you have it at the end. -You do not want to use quotes around your numbers and it acts like a string. It will make your numbers look like this "90" + "210" = "90210" -You do not want to use nested if statements since it will not pick up all of the checkboxes. You want to use just plain if statements - Your totals need to use a diferent start number or it is going to keep adding numbers to the total. Means that if a person keeps checking and unchecking the computer can cost a billion dollars. - You should use onClick instead of onChange since it works better for radio buttons - You need to add in onload event to put the total in or they can submit the form for free. -Also when you are calling the function, you need to include (). You are lucky I am nice today and did the changes for you:
Joined: Dec 11, 2003
Thank You Eric! You are my new best friend! It'd probably be better if I made the changes myself, so that's what I'm going to do. ^_^ Then I'll check yours against mine to make sure I understand what's going on. Thanks again. Patrick