I have a single input field and multiple calculated output fields using JavaScript :Click here to view the screenshot of the calculated problem
You can see the live preview on this link: . When you visit this link, enter "Base on your annual bill amount: $[input any value]" and observe that the output values are not calculated correctly. I am feeling frustrated and need assistance on how to generate proper output values. Here is an excerpt from my code:
function unit_val(){
var arr = document.getElementsByName('unit_val');
var unit_val_tot=0;
for(var i=0;i<arr.length;i++){
if(parseInt(arr[i].value))
unit_val_tot += parseInt(arr[i].value);
unit_val_tots =unit_val_tot.toFixed(2);
}
document.getElementById('total_amount').value = unit_val_tots;
document.getElementById('total_amount2').value = unit_val_tots;
}
Alternatively, you can also check the source code of the view page.