View Full Version : Real-Time Javasccript Calculator
Zaiaku
Aug 8th 2007, 3:54 pm
If someone can help me with this. I have this one here.
http://javascript.internet.com/forms/update-order-form-no-page-refresh.html
The problem is that it only accepts 1 radio button and 1 checcbox. What I need is for it to support 5 radio sellections only. Can anyone please help?
cbn81
Aug 8th 2007, 4:06 pm
On that page I see 3 checkboxes and 4 radio buttons. What do you mean "5 radio sellections only"?
Zaiaku
Aug 8th 2007, 4:11 pm
Sorry I meant 5 categories using only radio selections.
cbn81
Aug 8th 2007, 4:12 pm
so you want to do something like the small medium big thing on that page with radio boxes?
Zaiaku
Aug 8th 2007, 4:33 pm
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.
cbn81
Aug 9th 2007, 2:14 am
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>
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)">
Zaiaku
Aug 9th 2007, 6:36 am
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.
cbn81
Aug 9th 2007, 7:29 am
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.
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.