Try this:
Code:
function updateMatch(total) {
var totalMatch = document.getElementById("total_match");
var matchValue = 0;
var key = 1;
var div = document.getElementById("match_table_1");
var newTbody = document.createElement("tbody");
var match = new Array();
if (parseInt(totalMatch.value) > 0) {
/*Fetch the current values, then clear the table*/
var matchPaid = document.getElementsByTagName("input");
// for (var nr=0;nr < parseInt(totalMatch.value);nr++)
for (var nr=0; nr<matchPaid.length; nr++)
{
if (matchPaid[nr].name == "plan_bonus_amount[]")
{
match[match.length] = parseFloat(matchPaid[nr].value);
}
}
remove(div);
}
for (var nr=0;nr < total;nr++) {
if (typeof(match[nr]) != 'undefined') matchValue = match[nr];
else matchValue = 0;
newTbody = createMatch(newTbody, key, nr, matchValue);
}
div.appendChild(newTbody);
totalMatch.value = total;
}
Bookmarks