PDA

View Full Version : MSIE runtime error


jolietjake
03-21-2003, 10:31 AM
Hello, have some problem.

I've a table, with some records. When a user wants to delete a record (a row) I use this function:

document.getElementById("tr-"+idrecord).innerHTML="";

when tr-idrecord is the id I gave to the <tr> tag that I want to delete.

This works perfectly on Mozilla, but in MSIExplorer geves me a unknow runtime exception.

I think it is because it tries to delete the html that runs the function, so I tried to call it use a setTimeout, but no worked.

Someone can helpme?

Weirdan
03-21-2003, 02:26 PM
For MSIE instead of
document.getElementById("tr-"+idrecord).innerHTML="";
use
document.getElementById("tr-"+idrecord).innerText="";
It works (at least for MSIE 6.0)

Weirdan
03-21-2003, 02:34 PM
from MSDN:
innerHTML Property

[skip...]

The property is read/write for all objects except the following, for which it is read-only: COL, COLGROUP, FRAMESET, HTML, STYLE, TABLE, TBODY, TFOOT, THEAD, TITLE, TR. The property has no default value.

jkd
03-21-2003, 03:07 PM
Use some DOM:

var el = document.getElementById("tr-"+idrecord);
el.parentNode.removeChild(el);