<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1226" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>The obvious problem on product.length is that
product was not defined properly:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>var product = new Array [33]</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Should instead by:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>var product = new Array(33)</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Although to be honest with you, I wouldn't
hard-code how many elements are in this array. Define the variable as an array
then just add elements as you see fit. The length property will be set on its
own.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Chris Tifer</FONT></DIV>
<DIV><FONT face=Arial size=2><A
href="http://micclub.net">http://micclub.net</A></FONT></DIV>
<DIV> </DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=tannadice@iprimus.com.au href="mailto:tannadice@iprimus.com.au">Frank
Davie</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=javascript@LaTech.edu
href="mailto:javascript@LaTech.edu">javascript@LaTech.edu</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Tuesday, September 30, 2003 10:43
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [Javascript] form query</DIV>
<DIV><BR></DIV>
<DIV><FONT face=Arial size=2>Dear Javascript List,</FONT></DIV>
<DIV><FONT face=Arial size=2>I am teaching myself javascripting and have
decided to tackle this form menu, I have to display the totals, days,and email
confirm.</FONT></DIV>
<DIV><FONT face=Arial size=2>The only thing is I cannot get the script far
enough to calculate the total, I get an error message saying product.length is
null or not an object.</FONT></DIV>
<DIV><FONT face=Arial size=2>Could you possibly give me a solution to
calculate and display the subtotal and total so I can move on to the days and
email calcs.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>thanks</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>p.s </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I have enclosed the form </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>function calc(f){ <BR> var qty = new
Array();<BR> var subtotal;<BR> <BR> var total = 0;<BR> var
i = 0;<BR> var num= 1;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> while ( num !=0 && i <
product.length) {<BR> qty[i] =
num;<BR>
subtotal = subtotal + qty[i] *
prices[i]<BR> <BR> <BR> <BR>
}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial
size=2>
}</FONT></DIV>
<P>
<HR>
<P></P>_______________________________________________<BR>Javascript mailing
list<BR>Javascript@LaTech.edu<BR>https://lists.LaTech.edu/mailman/listinfo/javascript<BR></BLOCKQUOTE></BODY></HTML>