473,598 Members | 2,844 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Table appendChild/removeChild crashes IE6

Hi All,

I'm creating a table using createElement / appendChild and everything
works great.
Ussualy I have no more than 20 rows and they contain less that 5
columns.

Where my code starts to break (IE6 only, FF works great) is when I
quickly clear(removeChi ld) the table and insert new rows. My problem is
that I am getting a IE6 crash and the last log message shows a
different location most of the time.

Trying to use deleteRow, insertRow is no different and my understanding
is that innerHTML is readonly with TOM.

So what can I do? Any ideas?

Regards,
Sebastian

Jul 13 '06 #1
3 9856
sf****@gmail.co m wrote:
Hi All,

I'm creating a table using createElement / appendChild and everything
works great.
Ussualy I have no more than 20 rows and they contain less that 5
columns.

Where my code starts to break (IE6 only, FF works great) is when I
quickly clear(removeChi ld) the table and insert new rows. My problem is
that I am getting a IE6 crash and the last log message shows a
different location most of the time.

Trying to use deleteRow, insertRow is no different and my understanding
is that innerHTML is readonly with TOM.

So what can I do? Any ideas?

Regards,
Sebastian

Are you taking into account the implicit TBODY element?

HTML pages served as HTML always have an implicit TBODY element.
XHTML pages served as XHTML do not.
XHTML pages served as HTML may or may not.

Step carefully :-)

Jeremy
Jul 13 '06 #2

sf****@gmail.co m wrote:
Hi All,

I'm creating a table using createElement / appendChild and everything
works great.
Ussualy I have no more than 20 rows and they contain less that 5
columns.

Where my code starts to break (IE6 only, FF works great) is when I
quickly clear(removeChi ld) the table and insert new rows. My problem is
that I am getting a IE6 crash and the last log message shows a
different location most of the time.

Trying to use deleteRow, insertRow is no different and my understanding
is that innerHTML is readonly with TOM.

So what can I do? Any ideas?
Difficult to tell without code. In IE, when using
createElement/appendChild for table rows, you must add the rows to a
table section element (tbody, thead, tfoot). Other browsers allow you
to append created rows to the table and then add them to the tbody.

If you have a reference to an existing row, you can do something like:

var oTR = document.create Element('tr');
rowRef.parentNo de.appendChild( oTR);

insertRow is normally pretty reliable since it is DOM 1, remember to
include an index value for where to put the row (IE allows you to omit
it):

var oTR = tableRef.insert Row(-1);
'-1' will insert the row as the last in the table. The tableSection
interface supports insertRow too, so you can get a reference to a table
section element and use insertRow with that:

var oTR = tBodyRef.insert Row(-1);
The index must be in the range -1 to tBodyRef.rows.l ength. I've
created thousands of rows using insertRow in IE and never had any
problem with it.
--
Rob

Jul 13 '06 #3
Thanks for your responses Rob & Jeremy.

As I was trying to get a cleaner version of the
code(http://webfx.eae.net/dhtml/collist/columnlist.html) that I could
post I found the bug:

....
this._eBodyCols = this._eBodyTabl e.tBodies[0].rows[0].cells;
....

and then when remove row would remove the first row I'll be left with a
dangling reference.

The crash was happening when accessing the non-null
this._eBodyCols .length

So indeed, the bug was not in the TOM ;) but it's a crash nonetheless..

Regards,
Sebastian

Jul 19 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

25
5166
by: kie | last post by:
hello, i have a table that creates and deletes rows dynamically using createElement, appendChild, removeChild. when i have added the required amount of rows and input my data, i would like to calculate the totals in each row. when i try however, i receive the error: "Error: 'elements' is null or not an object"
1
7510
by: Steve S | last post by:
I need some help modifying this code. The code was orginally setup to add/remove a single table row. I modified it to add 2 (two) rows with one column that spans both rows. That part works. I just need help with the removerow function. Thanks for any help you can offer me. Here is the code: <html> <head> <title>New Document</title> <script type="text/javascript">
2
1458
by: Joakim Braun | last post by:
I'm trying to make an "editable table". You double-click on a table cell, it becomes a text input element, you edit the value, click outside the text input and the <td> contents/text node(s) are updated as the text input deletes itself. Much like file list controls in various operationg systems. The code below works fine in IE 6 for WinXP (no SP2), but fails in Opera 7.23 and Netscape 7.01. Specifically, onblur doesn't get called, so...
2
11511
by: Mike | last post by:
My page populates a table with a list of names and other information from a JavaScript object. I receive changes (adds, change & delete) to that list, convert it into a JavaScript object. I do understand how to add the new names to the list. I have 3 questions: 1) How can I search through the table rows to find the rows to be changed or removed?
1
3070
by: bumpy | last post by:
I wrote this pretty slick DHTML table that lets you add/remove rows and show/hide columns on the fly. It works perfectly in IE7, but it doesn't behave in Firefox 2.0.0.4. You can see it in action here: http://www.phreelancer.com/dyn_table/ If you start to add/remove rows and then show/hide columns a few times in FF, you'll see that some table cells are bundled together or that some hidden cells don't get collapsed (but are still empty)....
6
7983
by: Romulo NF | last post by:
Greetings again to everyone, Im back to show this grid componenet i´ve developed. With this grid you can show the data like a normal table, remove the rows that you need, add rows, import data, call determined functions, and edit the data already present What will you need to use the grid? A table with standard markup and an ID to call the script that will turn the table into a grid Parameters: tabelaID => id of the table that will...
4
1717
by: SirCodesALot | last post by:
Hi All, I am trying to dynamically replace a table in the dom, anyone have an idea on how to do this. here is some sample suedo code of what I want to do. var tableHTML = "<table id=\"table1\"><tr><td>this is table 1</td></ tr></table>"; var tableHTML2 = "<table id=\"table2\"><tr><td>this is table 2</td></
10
3199
by: r_ahimsa_m | last post by:
Hello, On index.html page I have a table with id="property_fields". <table id="property_fields" name="property_fields" border="0"> It contains set of rows with the following IDs: var propertyRows = new Array( "region_row", "town_row", "district_row", "address_row", "house_row", "floor_no_row", "rooms_row", "floors_row", "area_row", "year_built_row", "ownership_row", "standard_row", "garrage_row", "parking_row", "kitchen_row",...
5
4923
by: jrod11 | last post by:
hi, I found a jquery html table sorting code i have implemented. I am trying to figure out how to edit how many colums there are, but every time i remove code that I think controls how many colums there are, it crashes. There are currently 6 columns, and I only want 4. How do I remove the last two (discount and date)? Here is a link: http://www.jaredmoore.com/tablesorter/docs/salestable.html Here is some jquery js that I think...
0
7981
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7894
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8046
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8262
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6711
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5437
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3938
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2410
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1245
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.