I've got 2 div's and the first one has a form in it.
I want to create a table with the results of the form results in the second div.
It currently erases the page to create the table
Any help would be great. I don't use js too much, but for this job, I need to use it
Thanks
4 Replies - 2639 Views - Last Post: 27 June 2009 - 05:02 PM
Replies To: need to create a table in a div dynamically with js
#2
Re: need to create a table in a div dynamically with js
Posted 27 June 2009 - 12:36 AM
Well, you could make theHTML for the table then put it in the div based on its ID and using document.getElementById("IDHERE"); to get the object (div you want to put the table in), then use the innerHTML variable to se the object's inner HTML to the tble HTML.
Well, it is late, and I am not qquite sure tht makes any sense, so I'll check back in the morning.
Well, it is late, and I am not qquite sure tht makes any sense, so I'll check back in the morning.
#3
Re: need to create a table in a div dynamically with js
Posted 27 June 2009 - 12:57 AM
testDiv.innerHTML='<table><tr><td><strong>Month</strong></td><td><strong>Principle</strong></td><td><strong>Payment</strong></td></tr>';
This is what I did, but it's not working
thanks for helping
#4
Re: need to create a table in a div dynamically with js
Posted 27 June 2009 - 01:23 AM
testDiv.appendChild(document.createTextNode('<table><tr><td><strong>Month</strong></td><td><strong>Principle</strong></td><td><strong>Payment</strong></td></tr>'));
while(tblPrinciple>0){
testDiv.appendChild(document.createTextNode("<tr><td>"+curMonth+"/"+curYear+"</td><td>"+formatCurrency(tblPrinciple)+"</td><td>"+formatCurrency(pymnt)+"</td></tr>"));
mnthlyRate=(tblPrinciple*intRate);
tblPrinciple=tblPrinciple-(pymnt-mnthlyRate)-MonthlyDed;
tblPrinciple=tblPrinciple-OneTime;
OneTime=0;
if (YearlyDed!=0 && YearlyMth==curMonth){
tblPrinciple=(tblPrinciple-YearlyDed);
}
if (curMonth==12){
curMonth=1;
curYear++;
}
else{
curMonth++;
}//end if
} //end while
testDiv.appendChild(document.createTextNode("</table>"));
This is the code I've got and all it does is print the html code across the page instead of building my table.
Thanks for any help
#5
Re: need to create a table in a div dynamically with js
Posted 27 June 2009 - 05:02 PM
Nevermind, I got it working today.
Thanks anyway though.
Thanks anyway though.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|