Click to See Complete Forum and Search --> : editing tables


dabush
02-22-2003, 08:48 PM
how do you edit the contents in one cell of a table. i tried something like this

window.document.mytable.mycell.value = 'it worked';

where i have the following in <BODY></BODY>


<table name=mytable>
<tr>
<td name=mycell>chanage this</td>
</tr>
</table>

dabush
02-22-2003, 09:08 PM
u hit it right on. thanks

dabush
02-22-2003, 09:17 PM
oops...just kidding. it didnt work.


<table>
<tr>
<td id=cell1>cell1</td>
<td id=cell2>cell2</td>
</tr>
<tr>
<td id=cell3>cell3</td>
<td id=cell4>cell4</td>
</tr>
</table>


when i do

document.getElementById('cell4').innerHTML = "new cell";

cell4 becomes blank and the words "new cell" appear above the table.

an illustration

THIS:
______________
| cell1 | cell2 |
-----------------
| cell3 | cell4 |
-----------------

BECOMES after i execute command):

new cell
______________
| cell1 | cell2 |
-----------------
| cell3 |
-----------------

dabush
02-22-2003, 10:53 PM
i gots it 2 work, but thanks 4 urhelp!!!