How can I create an array that allows for auto calculation across multiple input fields? The current issue is that while the auto calculation functions properly for the first row, it fails to work on the second and third rows. My goal is to have this functionality extended over 15 rows.
Any assistance or guidance on this matter would be greatly appreciated.
<html>
<head>
<script type="text/javascript>
function calc(){
var textValues = [];
for(var i = 1; i <= 10; i++) {
textValues.push(document.getElementById('input' + i).value);
}
var total = 0;
for(var j = 0; j < textValues.length; j++){
total += textValues[j] * (10 - j);
}
document.getElementById('output').value = total;
}
</script>
</head>
<body>
[...]