[Javascript] form query

Robert Pollard rpollard at apple.com
Wed Oct 1 13:04:10 CDT 2003


In a addition to the other fine responses I want to add my $0.02 worth:

You can loop through all the elements on the page, retrieve the name of  
the elements and look for specific patterns in order to add them.  You  
can name your enterable elements with a consistent name like Qty1,  
Qty2, Qty3, etc. and when you hit these elements you can then do your  
math.

HTH,

Robert Pollard

On Tuesday, September 30, 2003, at 07:43 PM, Frank Davie wrote:

> Dear Javascript List,
> I am teaching myself javascripting and have decided to tackle this  
> form menu, I have to display the totals, days,and email confirm.
> 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.
> 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.
>  
> thanks
>  
> p.s
>  
> I have enclosed the form
>  
>  
>  
>  
> function calc(f){ 
>  var qty = new Array();
>  var subtotal;
>  
>  var total = 0;
>  var i = 0;
>  var num= 1;
>  
>  while ( num !=0 && i < product.length) {
>   qty[i] = num;
>                subtotal = subtotal + qty[i] * prices[i]
>   
>  
>  
>                                                }
>  
>                         }
> <CafeEastassignment.HTML>______________________________________________ 
> _
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 2105 bytes
Desc: not available
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20031001/7b31c076/attachment.bin>


More information about the Javascript mailing list