JS:
var total = 0;
var balances = document.getElementsByName(name);
for (var i = 0; i < balances.length; i ++) {
total += parseFloat(balances[i].value);
}
JQuery:
var total = 0;
jQuery.each($("input[name=name]"), function(index, value) {
total += parseFloat(value.value);
});