Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question What am i doing wrong?

    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
    Last edited by wilson382; 01-01-2012 at 08:34 PM. Reason: changed links

  • #2
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,772
    Thanks
    55
    Thanked 518 Times in 515 Posts
    case is a reserved keyword in javascript. if you change every instance of it in your code it works fine.

  • Users who have thanked xelawho for this post:

    wilson382 (12-31-2011)

  • #3
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts

    hahaha wow

    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
    Last edited by wilson382; 12-31-2011 at 11:31 PM. Reason: additional info

  • #4
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts
    bump up

  • #5
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,772
    Thanks
    55
    Thanked 518 Times in 515 Posts
    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?
    Code:
    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);

  • Users who have thanked xelawho for this post:

    wilson382 (01-01-2012)

  • #6
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts
    @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
    Code:
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •