I'm trying to write a function that will allow me to change the contents of a table cell. My table looks like this:
<table id="stock_table" style="table-layout:fixed">
<tr>
<td class = "positive">
<div id="symbol">GOOG</div>
<div id="change">+12.22</div>
<div id="lasttrade">539.08</div>
</td>
<td class = "positive">
<div id="symbol">ANF</div>
<div id="change">+4.24</div>
<div id="lasttrade">63.45</div>
</td>
It's a table that contains stock information and the like. The thing is, prices change fairly rapidly, so I need a way to modify the contents of the cells in the table. To get to each cell, I have the following Javascript function:
function goThruCells() {
var table = document.getElementById("stock_table");
for (var i = 0, row; row= table.rows[i]; i++) {
for (var j = 0, col; col = row.cells[j]; j++) {
**I don't know what to do here**
}
}
}
I'm not sure how to access each element in each cell. I realize that the table is nothing great, so if anyone has any re-design advice on that I'd gladly listen. If anyone has any advice or pointers, they would be greatly appreciated.