Real-Time Javasccript Calculator

Discussion in 'JavaScript' started by Zaiaku, Aug 8, 2007.

  1. #1
    Zaiaku, Aug 8, 2007 IP
  2. cbn81

    cbn81 Peon

    Messages:
    160
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    On that page I see 3 checkboxes and 4 radio buttons. What do you mean "5 radio sellections only"?
     
    cbn81, Aug 8, 2007 IP
  3. Zaiaku

    Zaiaku Well-Known Member

    Messages:
    484
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    108
    #3
    Sorry I meant 5 categories using only radio selections.
     
    Zaiaku, Aug 8, 2007 IP
  4. cbn81

    cbn81 Peon

    Messages:
    160
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    so you want to do something like the small medium big thing on that page with radio boxes?
     
    cbn81, Aug 8, 2007 IP
  5. Zaiaku

    Zaiaku Well-Known Member

    Messages:
    484
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    108
    #5
    Something like

    Harddrive
    1. 40gb + $50
    2. 60gb + $60
    3. 80gb + $70
    4. 100gb + $80

    Screen
    1. 13in + $50
    2. 14in + $60
    3. 17in + $70
    4. 21in + $80

    Ram
    1. 512mb + $50
    2. 1gb + $60
    3. 2gb + $70
    4. 3gb + $80


    Something like that so which ever they choose it ads up automatically in the box.
     
    Zaiaku, Aug 8, 2007 IP
  6. cbn81

    cbn81 Peon

    Messages:
    160
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Well, where is the problem?

    <input type="radio" name="group1" value="Milk" /> Milk<br>
    <input type="radio" name="group1" value="Butter" checked /> Butter<br>
    <input type="radio" name="group1" value="Cheese" /> Cheese
    <hr>
    <input type="radio" name="group2" value="Water" /> Water<br>
    <input type="radio" name="group2" value="Beer" /> Beer<br>
    <input type="radio" name="group2" value="Wine" checked /> Wine<br>
    HTML:
    And so on, you can make how many groups you like. Then you hjave to ad the js code that calculates the total, but I think you already have this.

    PS: if you don't have this code, you should create a function an call it from the onclick met5hod of the radio button:
    <input type="radio" name="group2" value="Water" onclick="addToTotal(120)">
     
    cbn81, Aug 9, 2007 IP
  7. Zaiaku

    Zaiaku Well-Known Member

    Messages:
    484
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    108
    #7
    I have the code that I got with the original script. But it only ads 1 radio selection to check box solutions. Since I'm not good with javascript but even as novice as I am I don't see how to add each catergory togerther wcomparing with the original script.
     
    Zaiaku, Aug 9, 2007 IP
  8. cbn81

    cbn81 Peon

    Messages:
    160
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #8
    If the code is the one in the page on your first post, you should modify it, since it uses only a group of radio buttons. I think you will find a better example somewhere else on the net.
     
    cbn81, Aug 9, 2007 IP