Hello everyone... this code works in Firefox and not IE, any obvious mistakes ?
NOTES:
- round() is a javascript function that works (tried and true)
========= code begins ====================
function get_balance() {
var start_amt = document.forms[0].start_amt_toward_debt.value;
var total_payment = 0;
var percent_owed = 0;
var payment_amt = 0;
var total_owed = 0.00;
for(i=0; i<15; i++) {
myBalance = 'balance'+i;
if(parseFloat(document.getElementById(myBalance).value)) {
total_owed = parseFloat(document.getElementById(myBalance).value) + total_owed ;
}
}
for(i=0; i<15; i++) {
myBalance = 'balance'+i;
myPayment = 'p_payment'+i;
creditor_amt = parseFloat(document.getElementById(myBalance).value);
percent_owed = (creditor_amt / total_owed) ;
payment_amt = (start_amt * percent_owed) ;
if (payment_amt > 0) {
document.forms[0].eval(myPayment).value = round(payment_amt) ;
total_payment += payment_amt ;
} else {
document.forms[0].eval(myPayment).value = '' ;
}
}
document.forms[0].total_balance.value = round(total_owed);
}
========= code ends ====================
NOTES:
- round() is a javascript function that works (tried and true)
========= code begins ====================
function get_balance() {
var start_amt = document.forms[0].start_amt_toward_debt.value;
var total_payment = 0;
var percent_owed = 0;
var payment_amt = 0;
var total_owed = 0.00;
for(i=0; i<15; i++) {
myBalance = 'balance'+i;
if(parseFloat(document.getElementById(myBalance).value)) {
total_owed = parseFloat(document.getElementById(myBalance).value) + total_owed ;
}
}
for(i=0; i<15; i++) {
myBalance = 'balance'+i;
myPayment = 'p_payment'+i;
creditor_amt = parseFloat(document.getElementById(myBalance).value);
percent_owed = (creditor_amt / total_owed) ;
payment_amt = (start_amt * percent_owed) ;
if (payment_amt > 0) {
document.forms[0].eval(myPayment).value = round(payment_amt) ;
total_payment += payment_amt ;
} else {
document.forms[0].eval(myPayment).value = '' ;
}
}
document.forms[0].total_balance.value = round(total_owed);
}
========= code ends ====================