Michael Satterwhite wrote:
I need to be able to dynamically change the contents of a table cell (e.g.
the text between <td> and </td>. I've been searching the web, but haven't
found the solution to this one.
I know the rows index and the cells index in the row. What do I need to do
to affect the contents?
A td element object is not different to other element objects meaning
you can use the usual browser stuff like manipulating innerHTML or like
using the W3C DOM e.g. appendChild, insertBefore, replaceChild with
appropriately created nodes (e.g. document.createElement('p'),
document.createTextNode('Kibology')) to alter the content.
If you have the table element object and the row and cell index then in
the HTML DOM
var cell = tableElement.rows[rowIndex].cells[cellIndex]
gives you the cell, then a cross browser and short way to replace its
contents with some HTML snippet is
cell.innerHTML = '<p>Kibology for all.<\/p>';
--
Martin Honnen
http://JavaScript.FAQTs.com/