can someone PLEASE HELP!
CODE
function writeHeader(){ //writes header for amort Table
var hdrDiv=document.getElementById("schedule")
var hdrTable=document.createElement("table");
hdrTable.id="tblHeader";
hdrTable.setAttribute("width","100%");
hdrTable.setAttribute("border","1");
var hdrBody=document.createElement("tbody");
var hdrRow=document.createElement("row");
var hdrDate=document.createElement("td");
var hdrPrinciple=document.createElement("td");
var hdrPayment=document.createElement("td");
hdrDate.appendChild(document.createTextNode("Date"));
hdrPrinciple.appendChild(document.createTextNode("Principle"));
hdrPayment.appendChild(document.createTextNode("Payment"));
hdrRow.appendChild(hdrDate);
hdrRow.appendChild(hdrPrinciple);
hdrRow.appendChild(hdrPayment);
hdrBody.appendChild(hdrRow);
hdrTable.appendChild(hdrBody);
hdrDiv.appendChild(hdrTable);
}
function PrintTable(cost,intRate, pymnt,mortDate){ //prints table for top calculator
var curMonth,tblPrinciple=cost,mnthlyRate=0,curYear,YearlyDed,YearlyMth,OneTime;
writeHeader();
curMonth=mortDate.getMonth();
curMonth++;
curYear=mortDate.getFullYear();
var newDiv=document.createElement("div");
var ScheduleResults=document.getElementById("schedule");
var tblBody=document.createElement("tbody");
var newTable=document.createElement("table");
newTable.setAttribute("width","100%");
newTable.setAttribute("border",4);
while(tblPrinciple>0){
var DateData=document.createElement("td");
var PrinData=document.createElement("td");
var PymtData=document.createElement("td");
var newRow=document.createElement("tr");
DateData.appendChild(document.createTextNode(curMonth+"/"+curYear));
PrinData.appendChild(document.createTextNode(formatCurrency(tblPrinciple)));
PymtData.appendChild(document.createTextNode(formatCurrency(pymnt)));
newRow.appendChild(DateData);
newRow.appendChild(PrinData);
newRow.appendChild(PymtData);
mnthlyRate=(tblPrinciple*intRate);
tblPrinciple=tblPrinciple-(pymnt-mnthlyRate);
if (curMonth==12){
curMonth=1;
curYear++;
}
else{
curMonth++;
}//end if
tblBody.appendChild(newRow);
} //end while
newTable.appendChild(tblBody);
newDiv.appendChild(newTable);
ScheduleResults.appendChild(newDiv);
}