...

View Full Version : What am i doing wrong?



wilson382
12-31-2011, 10: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
http://wilson382.info/code.html

or just download the file so you can revise and test code easily
http://wilson382.info/build.zip

what I want to do will work exactly like this:
http://wilson382.info/src.html
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.

edit:
it works fine now but its not giving me the correct result
the correct result is 1076
check it out:
http://wilson382.info/build.html

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

wilson382
12-31-2011, 11: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

wilson382
01-01-2012, 07:41 PM
bump up

xelawho
01-01-2012, 08: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);

wilson382
01-01-2012, 09:45 PM
@xelawho
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