Javascript - Referencing Form elements
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Hetal_Naik
Posted On:   Saturday, December 6, 2003 06:35 PM

Hi, I've a Form that have various columns called stocklondon, stockny,stockjapan......etc etc. Since there are multiple rows for each columns, their names are suffixed with 1,2,3,.... and so on. This number is pretty much dynamic. The form has columns with form elements as : stocklondon1 stockny1 stockjapan1 stocklondon2 stockny2 stockjapan2 stocklondon3 stockny3 stockjapan3 stocklondon4 stockny4 stockjapan4 : : : : : : Their totalnumber is unknown. I want to sum the row quantities, i.e. all 1's, 2's, 3's..... and so on. I want to make a loop like this : for (int   More>>

Hi,

I've a Form that have various columns called stocklondon, stockny,stockjapan......etc etc. Since there are multiple rows for each columns, their names are suffixed with 1,2,3,.... and so on. This number is pretty much dynamic. The form has columns with form elements as :

			
stocklondon1 stockny1 stockjapan1
stocklondon2 stockny2 stockjapan2
stocklondon3 stockny3 stockjapan3
stocklondon4 stockny4 stockjapan4
: : :
: : :

Their totalnumber is unknown.

I want to sum the row quantities, i.e. all 1's, 2's, 3's..... and so on. I want to make a loop like this :
			
for (int i=0;i
{
document.form.total[i].value=document.form.stocklondon[i].value + document.form.stockny[i].value + document.form.stockjapan[i].value;
}

However, it does not recognize this as a form element and gives an error.

How can I accomplish this ??? ( without using form[0].elements, since I want values of 1 summed to total of 1 )

Thanks.    <<Less

Re: Javascript - Referencing Form elements

Posted By:   Hetal_Naik  
Posted On:   Sunday, December 7, 2003 04:52 AM

Never Mind.... Got it using eval().
About | Sitemap | Contact