Hi All,
I have the following function that calls a function to calculate time and then writes the result to a table cell. I need to sum the results at the bottom row of the table. For some reason I am getting NaN. I tried using parseFloat() to make sure my variable was being interpreted as a number but no luck. Any help is appreciated.
Code:
function outageLength() {
var rows=document.getElementById("vari").getElementsByTagName("tr");
for (var x = 1; x < rows.length-1; x++) { //start at 1 to skip the header cells
var start=rows[x].cells[0].innerHTML;
var end=rows[x].cells[1].innerHTML;
var rowTotal=calculateTime(start,end);
rows[x].cells[4].innerHTML=rowTotal;
var rowSecs=TimeToSecs(rowTotal);
rowSecs=parseFloat(rowSecs);
var totalSecs;
totalSecs += rowSecs;
}
var grandTotalElem = window.document.getElementById("grandTotal");
grandTotalElem.innerHTML=totalSecs;
}
Thanks in advance,
Ken