I have written this code and it executes well but I would like to instead of using an array of multiple textfields write an array that will allow me to add additional textfields but not have to add a new array element. Can anyone help me with writing this array?
[CODE]
<script language=”JavaScript”>
function calculate(what) {
var text = new Array(4)
text[0] = document.chmod.textField1
text[1] = document.chmod.textField2
text[2] = document.chmod.textField3
text[3] = document.chmod.textField4
text[4] = document.chmod.textField5
var boxes = document.chmod.box;
var a=0;
var b=0;
for (i = 0; i < boxes.length; i++)
{
if (boxes[i].checked == true)
{
a +=(text[i].value*1)
} else if (boxes[i].checked == false) {
b +=(text[i].value*1)
}
}
document.chmod.Matching_Funds.value=a
document.chmod.Other_Funds.value=b
}
</script>
<input type=”text” size=”12″ name=”textField1″ onBlur=”calculate(this.form)”></td>
[CODE]