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

Peter Brunone (EasyListBox.com) peter at easylistbox.com
Thu Apr 6 12:52:00 CDT 2006


		Of course if you enclose the table in a div or span, you can set the innerHTML of THAT element...

				From: Mattias Thorslund mattias at thorslund.us

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
tables:

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.

FWIW

Mattias



More information about the thelist mailing list