K
Kissingfish
Hi there..
I'm trying to configure a quote form for my website.. I want to have
different fields, for example radio buttons, check boxes and drop-down
menus, and depending on what you select, a different value will appear
on the 'total' box down the bottom..
I can figure out how to write a scipt and have textboxes add up to a
total.. And I can do it with dropdown menus, like this..
<script type="text/javascript"><!--
function updatesum() {
document.form.sum.value =
(document.form.number1.options[document.form.number1.selectedIndex].text-0)
+
(document.form.number2.options[document.form.number2.selectedIndex].text-0);
}
//--></script>
<form name="form" action="">
number1
<select name="number1" onChange="updatesum()">
<option selected>0<option>1<option>2<option>3<option>4
<option>5<option>6<option>7<option>8<option>9
</select>
number2
<select name="number2" onChange="updatesum()">
<option selected>0<option>1<option>2<option>3<option>4
<option>5<option>6<option>7<option>8<option>9
</select>
Their sum is:</th> <td><input name="sum" readonly style="border:none"
value="(not computed)">
</form>
And so on..
But I can't get it to interact with radio buttons, for example, instead
of a dropdown number, simply have a radio button (or a check box) with
an assigned value, it doesn't recognize it..
Please help.. I know am missing something.. Or maybe point me to a
website that might have such example I can practice from..
I'm trying to configure a quote form for my website.. I want to have
different fields, for example radio buttons, check boxes and drop-down
menus, and depending on what you select, a different value will appear
on the 'total' box down the bottom..
I can figure out how to write a scipt and have textboxes add up to a
total.. And I can do it with dropdown menus, like this..
<script type="text/javascript"><!--
function updatesum() {
document.form.sum.value =
(document.form.number1.options[document.form.number1.selectedIndex].text-0)
+
(document.form.number2.options[document.form.number2.selectedIndex].text-0);
}
//--></script>
<form name="form" action="">
number1
<select name="number1" onChange="updatesum()">
<option selected>0<option>1<option>2<option>3<option>4
<option>5<option>6<option>7<option>8<option>9
</select>
number2
<select name="number2" onChange="updatesum()">
<option selected>0<option>1<option>2<option>3<option>4
<option>5<option>6<option>7<option>8<option>9
</select>
Their sum is:</th> <td><input name="sum" readonly style="border:none"
value="(not computed)">
</form>
And so on..
But I can't get it to interact with radio buttons, for example, instead
of a dropdown number, simply have a radio button (or a check box) with
an assigned value, it doesn't recognize it..
Please help.. I know am missing something.. Or maybe point me to a
website that might have such example I can practice from..