Hello,
I’m trying to use the following function to change the text that lies between a DIV tag, however its not working any ideas…
function changeDateValue()
{
advisory = document.getElementById(‘div_w0d2’);
advisory.removeChild(advisory.childNodes[0]);
advisory.appendChild(document.createTextNode(‘1’));
}
and the HTML…
<table border=”1″>
<tr>
<td width=”25″ id=”td_w0d0″><div id=”div_w0d0″></div></td>
<td width=”25″ id=”td_w0d1″><div id=”div_w0d1″></div></td>
<td width=”25″ id=”td_w0d2″><div id=”div_w0d2″></div></td>
<td width=”25″ id=”td_w0d3″><div id=”div_w0d3″></div></td>
<td width=”25″ id=”td_w0d4″><div id=”div_w0d4″></div></td>
<td width=”25″ id=”td_w0d5″><div id=”div_w0d5″></div></td>
<td width=”25″ id=”td_w0d6″><div id=”div_w0d6″></div></td>
</tr>
</table>
When the function executes, the IDEA is to place a ‘1’ in the div tag and thus in corresponding table cell, however I keep getting the cryptic message:
Error: uncaught exception: [Exception… “Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMHTMLDivElement.removeChild]” nsresult: “0x80004003 (NS_ERROR_INVALID_POINTER)” location: “JS frame :: file:///I:/developement/datepicker.html :: changeDateValue :: line 36” data: no]