PDA

View Full Version : getElementById properties



bigcougar
14 Oct 2010, 12:53 PM
I am trying to change the value of a table cell in JavaScript using the getElementById method. The cell has a defined id and a value in it.

Like in this example , a table with one column and two rows.


<table width="100%" border="0" align="left" cellpadding="0" cellspacing="0" class="" bgcolor="#D6D6D6">
<tr>
<td width="8.3%">Jan</td>
</tr>
<tr>
<td width="8.3%" align="center" id="jan">0</td>
</tr>
</table>

If I try to assign a value to getElementById(['jan']).value, it looks like I am using the wrong property.

What is the correct property to access and change the value "0" in the second cell of my table?

bigcougar
14 Oct 2010, 01:31 PM
I figured it out.

.innerHTML

Thanks.