• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 799
  • Last Modified:

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.value/100;
 discTotal = discPerc*document.form1.subTotal.value;
 document.form1.discTotal.value = discTotal
 }
 //-->
</SCRIPT>

<tr>
<td colspan="2" align="right"><INPUT onclick=perc1() type=button value=Calculate>&nbsp;&nbsp;<i><%=discCode%></i>&nbsp;&nbsp;<input type="text" name="discPerc" size="4" maxlength="10" value="<%=moneyD(formatNumber(discPerc,2))%>" />%&nbsp;&nbsp;<b>Discount Code:&nbsp;&nbsp;</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.value is null or not an object.

The form is named form1. Can anyone help?
0
ChristinaPupo
Asked:
ChristinaPupo
  • 2
2 Solutions
 
Melih SARICAIT ManagerCommented:
could u send all html code.. to see the document schema
0
 
HonorGodCommented:
make sure to include the form tag that should look like:

<form name="form1"  ... >
0
 
ChristinaPupoAuthor Commented:
Thanks, I found the problem. There was another form on the page with the same name. Thanks anyway!
0
 
HonorGodCommented:
Thank you!  Your assist put me over the threshold of "Sage" for JavaScript! :-)

Thanks for the grade & points.

Good luck & have a great day.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now