JoeP
01-17-2005, 10:57 PM
I have a form with 36 fileds. For demo Fields are named Field1...Field36
A total Field named SumTotal
Would someone please show me proper syntax to run a FOR loop to add the fields on a call to a function called Add_Fields() and get the variable sumTotal.
e.g.: Something like:
<SCRIPT>
function Add_Fields(){
var sumTotal=0
for(i = ; i <= 36; i++)
{sumTotal=document.forms.Data_Entry.Field+i.value}
alert('Your Total'+sumTotal)
document.forms.Data_Entry.value=sumTotal
}
</SCRIPT>
:o
A total Field named SumTotal
Would someone please show me proper syntax to run a FOR loop to add the fields on a call to a function called Add_Fields() and get the variable sumTotal.
e.g.: Something like:
<SCRIPT>
function Add_Fields(){
var sumTotal=0
for(i = ; i <= 36; i++)
{sumTotal=document.forms.Data_Entry.Field+i.value}
alert('Your Total'+sumTotal)
document.forms.Data_Entry.value=sumTotal
}
</SCRIPT>
:o