my array consists of 6 elements out of which as on date 4 are empty or 0 because previous month data comes next month as under:
July-12 Aug-12 Sep-12 Oct-12 nov-12 Dec-12
212 214
the data for the sep is availabel on 31st oct and so on.
i wanted to calculate the average every month of the available data.
so I wrote the follwing code in js.
Code:
script type="text/javascript">
 	function SumAverage()
	{		
	var indxnos = new Array(6)
	indxnos[0]= document.DA_Slabs.jul12.value
	indxnos[1]= document.DA_Slabs.aug12.value
	indxnos[2]= document.DA_Slabs.sep12.value
	indxnos[3]= document.DA_Slabs.oct12.value
	indxnos[4]= document.DA_Slabs.nov12.value
	indxnos[5]= document.DA_Slabs.dec12.value
	var Sum = 0
	var Average 
	for (var i = 0; i < indxnos.length; i++)	
   	Sum=Sum+parseInt(indxnos[i]		
	Average = Sum/indxnos.length
               Math.round(Average)			document.DA_Slabs.avg.value= Average
	</script
if i populate the empty data 0 ,as on date the average comes to 71 instead 213 because the array length is 6 instead of 2 required to be used for correct results.
I am new to JS and arrays so I donot know how to reduce the length of the array while calculating average every month till the half year.I have taken the array as 6 as an example although the data that is required to be used is for more than 5 years. It seems easy to divide by 2 and proceed so on but in actual case the array consists of about 60 months and so I need help.

Further advise me to further clean or shorten my code
so that every month I get the correct average.
thanks

vkwd7























[/CODE]