Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Help with javascript error "..is null or not an object"

Posted on 2008-06-12
4
Medium Priority
?
796 Views
Last Modified: 2008-06-12
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
Comment
Question by:ChristinaPupo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 19

Accepted Solution

by:
Melih SARICA earned 1000 total points
ID: 21774288
could u send all html code.. to see the document schema
0
 
LVL 41

Assisted Solution

by:HonorGod
HonorGod earned 1000 total points
ID: 21774541
make sure to include the form tag that should look like:

<form name="form1"  ... >
0
 

Author Comment

by:ChristinaPupo
ID: 21774653
Thanks, I found the problem. There was another form on the page with the same name. Thanks anyway!
0
 
LVL 41

Expert Comment

by:HonorGod
ID: 21774764
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question