I am encountering a problem and would appreciate some assistance. The issue I am facing is related to a grid I have created. While the values are calculated correctly in the first row of the grid, the calculations do not seem to have any effect on the other rows. I have utilized a data table in the backend to store the information. What steps should I take to address this situation? Any help would be greatly appreciated.
Custom JavaScript Function
function CalculateTotal() {
var Gtot = 0;
var Participation = document.getElementById('txtCl_Part').value-0;
var Assgnmnt = document.getElementById('txtAssgnmnt').value-0;
var Quiz = document.getElementById('txtQuiz').value-0;
var WrPaper = document.getElementById('txtWP').value-0;
var OSME = document.getElementById('txtOSME').value-0;
var Total = parseFloat(Participation) + parseFloat(Assgnmnt) + parseFloat(Quiz) + parseFloat(WrPaper) + parseFloat(OSME);
if (!isNaN(Total)) {
document.getElementById('txtTotal').value = Total;
} else {
alert("Error: Unable to calculate total.");
}
var getTotal = document.getElementById('txtTotal').value - 0;
Gtot = parseInt(Gtot) + parseFloat(getTotal);
if (!isNaN(Gtot)) {
document.getElementById('txtGTot').value = Gtot;
} else {
alert("Error: Unable to display grand total.");
}
var Percentage = (parseFloat(Gtot) * 100) / 400;
if (!isNaN(Percentage)) {
document.getElementById('txtPercent').value = Percentage;
} else {
alert("Error: Unable to calculate percentage.");
}
}