PRB: Error Setting table.innerHTML in Internet Explorer

ID: Q239832


The information in this article applies to:
  • Microsoft Internet Explorer (Programming) versions 4.0, 4.01, 4.01 SP1, 4.01 SP2, 5


SYMPTOMS

Setting table.innerHTML causes the following error message to appear:

Unknown runtime error


CAUSE

The innerHTML property of the TABLE, TFOOT, THEAD, and TR elements are read-only.


RESOLUTION

To change the contents of these table elements, use the table object model or Document Object Model (DOM).


STATUS

This behavior is by design.


MORE INFORMATION

Use the rowIndex property or the rows collection to retrieve a reference to a specific table row. You can add or delete rows using the insertRow and deleteRow methods.

To retrieve a reference to a specific cell, use the cellIndex property or the cells collection. You can add or delete cells using the insertCell and deleteCell methods. To change the content of a particular cell, use the innerHTML property.

More options are available by using methods of the DOM. You can use the createElement method to create elements for the table and then the other DOM methods and properties (such as insertBefore, swapNode, and so forth), which are available to modify the table contents.


REFERENCES

For more information on building tables dynamically see the following article on the MSDN Web Workshop:

http://msdn.microsoft.com/workshop/author/tables/BuildTables.asp
For more information on the Document Object Model see the DOM Overview article on the MSDN Web Workshop:
http://msdn.microsoft.com/workshop/author/dom/domoverview.asp

For more information, please see the MSDN Web Workshop:
http://msdn.microsoft.com/workshop/default.asp

Additional query words: table innerhtml

Keywords : kbDHTML kbIE400 kbIE401 kbIE401sp1 kbIE401sp2 kbGrpInet kbIE500 kbDSupport
Version : WINDOWS:4.0,4.01,4.01 SP1,4.01 SP2,5
Platform : WINDOWS
Issue type : kbprb


Last Reviewed: October 29, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.