ChristinaPupo
asked on
Help with javascript error "..is null or not an object"
Hi, I have a javascript that is supposed to calculate a discount percentage:
<SCRIPT language=JavaScript>
<!--
function perc1() {
discPerc = document.form1.discPerc.va lue/100;
discTotal = discPerc*document.form1.su bTotal.val ue;
document.form1.discTotal.v alue = discTotal
}
//-->
</SCRIPT>
<tr>
<td colspan="2" align="right"><INPUT onclick=perc1() type=button value=Calculate> &nbs p;<i><%=di scCode%></ i> &n bsp;<input type="text" name="discPerc" size="4" maxlength="10" value="<%=moneyD(formatNum ber(discPe rc,2))%>" />% <b>Discount Code: </b></td>
<td nowrap=""><%=pCurrencySign %><input type="text" name="discTotal" size="5" maxlength="10" value="<%=moneyD(discTotal )%>" />(-)</td>
</tr>
BUT I keep getting this error:
document.form1.discPerc.va lue is null or not an object.
The form is named form1. Can anyone help?
<SCRIPT language=JavaScript>
<!--
function perc1() {
discPerc = document.form1.discPerc.va
discTotal = discPerc*document.form1.su
document.form1.discTotal.v
}
//-->
</SCRIPT>
<tr>
<td colspan="2" align="right"><INPUT onclick=perc1() type=button value=Calculate> &nbs
<td nowrap=""><%=pCurrencySign
</tr>
BUT I keep getting this error:
document.form1.discPerc.va
The form is named form1. Can anyone help?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thank you! Your assist put me over the threshold of "Sage" for JavaScript! :-)
Thanks for the grade & points.
Good luck & have a great day.
Thanks for the grade & points.
Good luck & have a great day.
ASKER