[thelist] innerHTML on a table (Was: AJAX Tip)

Mattias Thorslund mattias at thorslund.us
Thu Apr 6 12:41:35 CDT 2006

kasimir-k wrote:
> Clever - no. Fast - yes. If I happen to end up with a table with 
> hundreds of rows, and must manipulate it client side, I just might rely 
> on innerHTML. (Naturally heavy tasks are often better done server side, 
> but sometimes that is not an option.)

In case someone reading the above thought of doing some innerHTML in

Setting the innerHTML of tables (and table rows and some other table
sub-elements) is NOT supported in Internet Explorer. Setting the
innerHTML on table rows works in Firefox (didn't try on a table), but in
IE, you have to walk through each cell (TD or TH) and set their
innerHTML separately.

Not as handy, perhaps, but I suppose it guarantees that the number of
rows and columns are consistent after a change. Merged cells (colspan>1,
rowspan>1) might be a problem, too. Anyway, I had hoped to replace table
rows, updated via XHR (great new? acronym...), but had to settle for a
less "convenient" solution.



More information about the thelist mailing list