The Enchanted Cave 2
Delve into a strange cave with a seemingly endless supply of treasure, strategically choos
4.36 / 5.00 33,851 ViewsGhostbusters B.I.P.
COMPLETE edition of the interactive "choose next panel" comic
4.09 / 5.00 12,195 ViewsI'm trying to create a dynamic radio button in my order form for a website I'm working on.
The form defaults on certain items (Item #2) When the page is loaded
ex.
Item #1 (-$50)
Item #2 ($154) [SELECTED]
Item #3 (+$10)
Item #4 (-$20)
Total Amount: $154
What I want my form to do is when the user selects another item I want the total amount to go up or down in the amount according to which item the user choose. I have no idea where to start on this, Could I please get some help.
Also... If its possible....
I would like my form to make some items on the list un-choosable when another item is chosen.
Ex.
Item #1 ($104) [SELECTED]
Item #2 (+$154)
Item #3 (+$10)
Item #4 (-$20) [Cannot be Selected (Disabled Radio Button only when item #1 or item #2 is selected)]
Please help! HTML, PHP, Javascript, ext is acceptable.
Working example:
<script type='text/javascript'>
function disable()
{
document.getElementsByName('group1')[3].disabled = true;
}
function enable()
{
document.getElementsByName('group1')[3].disabled = false;
}
function twrite(str)
{
document.getElementById('t').innerHTML += str + "<br />";
}
</script>
<input type="radio" name="group1" value="Milk" onFocus='disable();' onClick='twrite(this.value);' /> Milk<br />
<input type="radio" name="group1" value="Butter" checked onFocus='disable();' onClick='twrite(this.value);' /> Butter<br />
<input type="radio" name="group1" value="Cheese" onFocus='enable();' onClick='twrite(this.value);' /> Cheese<br />
<input type="radio" name="group1" value="Sauce" onClick='twrite(this.value);' disabled /> Sauce<br />
Your orders sir!<br />
<div id='t'>
</div>
not the best but it demonstrates what you want.
At 4/5/09 02:43 PM, polym wrote: Working example:
not the best but it demonstrates what you want.
Thank you so much! But, now for the first part.
At 4/5/09 02:52 PM, newgiez wrote: Thank you so much! But, now for the first part.
Dude I figured it would be common sense, but you have a variable that contains the total amount
then whenever a radio button is selected replace (instead of adding to) the div's innerHTML with the total.
Messing around a little I came up with something like this, that can be easily expanded upon.