View Full Version : What am i doing wrong?

12-31-2011, 09:59 PM
I'm trying add the value of multiple text boxes automatically using javascript

i revised the code many many times but i cant find an error or maybe im missing something

you can find the source code in the link below

or just download the file so you can revise and test code easily

what I want to do will work exactly like this:
The working code of this script i got it from http://javascriptsource.com/
so credit goes to them

thank in advance to anyone who try to help.

it works fine now but its not giving me the correct result
the correct result is 1076
check it out:

12-31-2011, 10:16 PM
case is a reserved keyword in javascript. if you change every instance of it in your code it works fine.

12-31-2011, 10:52 PM
wow just like you said i did it
and it worked instantly

gotta love coding just a letter or world would mess up the whole project haha

thank very much man

01-01-2012, 06:41 PM
bump up

01-01-2012, 07:03 PM
if you have a new problem, please add that to the latest post rather than editing the original one and just bumping the thread - your method means we have to read back over the entire thread to see what you have edited and why you are bumping it.

As to your problem, you seem to end up with a total that is $320 too much.

Which item costs $320 and what do you see wrong with this line?

document.AddItUp.total.value = (motherboard * 1) + (CPU * 1) + (RAM * 1) + (video_card * 1) + (sound_card * 1) + (hard_drive * 1) + (optical_drive * 1) + (case1 * 1) + (CPU * 1) + (power_supply * 1);

01-01-2012, 08:45 PM
yeah you are right i put CPU twice on the code which means it was gonna add it twice thats why i ended up having 320 higher than current price thankz man

i had

document.AddItUp.total.value = (motherboard * 1) + (CPU * 1) + (RAM * 1) + (video_card * 1) + (sound_card * 1) + (hard_drive * 1) + (optical_drive * 1) + (case1 * 1) + (CPU * 1) + (power_supply * 1);

if u notice there was 2 (CPU * 1) +

thank for helping me find the mistake

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum