megan_t
01-22-2004, 10:27 AM
Hi,
I'm trying to develop somewhat of a dynamic form, and I've run into some trouble. The page uses both radio buttons and check boxes so that the user can choose what he or she wants to purchase, and I'm trying to get the Registration cost (radio button) and total cost (registration + event costs (checkboxes)) to display. The checkboxes seem to work all right, but the browser gives me this error message: "Object doesn't support this property or method" referencing a line of code in function calc() -- RegCost = parseFloat(Reg[i].value);
I don't really know what I'm doing, so any help would be appreciated. Thanks
Sorry so long!
function calc()
{
with (document.myform)
{
Event1Total.value = format(Event1.value * Event1Cost);
Event2Total.value = format(Event2.value * Event2Cost);
Event3Total.value = format(Event3.value * Event3Cost);
Event4Total.value = format(Event4.value * Event4Cost);
Event5Total.value = format(Event5.value * Event5Cost);
for (i=0; i < Reg.length; i++)
if (Reg[i].checked)
RegCost = parseFloat(Reg[i].value);
total.value = format (Regcost + parseFloat Event1Total.value) + parseFloat(Event2Total.value) + parseFloat(Event3.value) + parseFloat(Event4.value)+ parseFloat(Event5.value));
}
}
<SNIP>
<input type="radio" value="250" name="Reg" id="Reg" checked onclick="calc()">
Full — $250/person <p>
<input type="radio" value="100" name="Reg" id="Reg" onclick="calc()">
Student — $100/person <br>
</td>
<td> <input type="text" id="RegCost" name="RegCost" size="6" readonly>
I'm trying to develop somewhat of a dynamic form, and I've run into some trouble. The page uses both radio buttons and check boxes so that the user can choose what he or she wants to purchase, and I'm trying to get the Registration cost (radio button) and total cost (registration + event costs (checkboxes)) to display. The checkboxes seem to work all right, but the browser gives me this error message: "Object doesn't support this property or method" referencing a line of code in function calc() -- RegCost = parseFloat(Reg[i].value);
I don't really know what I'm doing, so any help would be appreciated. Thanks
Sorry so long!
function calc()
{
with (document.myform)
{
Event1Total.value = format(Event1.value * Event1Cost);
Event2Total.value = format(Event2.value * Event2Cost);
Event3Total.value = format(Event3.value * Event3Cost);
Event4Total.value = format(Event4.value * Event4Cost);
Event5Total.value = format(Event5.value * Event5Cost);
for (i=0; i < Reg.length; i++)
if (Reg[i].checked)
RegCost = parseFloat(Reg[i].value);
total.value = format (Regcost + parseFloat Event1Total.value) + parseFloat(Event2Total.value) + parseFloat(Event3.value) + parseFloat(Event4.value)+ parseFloat(Event5.value));
}
}
<SNIP>
<input type="radio" value="250" name="Reg" id="Reg" checked onclick="calc()">
Full — $250/person <p>
<input type="radio" value="100" name="Reg" id="Reg" onclick="calc()">
Student — $100/person <br>
</td>
<td> <input type="text" id="RegCost" name="RegCost" size="6" readonly>