Cannot add row to beginning of data-bound table (IE bug!)

Giganews Newsgroups
Subject: Cannot add row to beginning of data-bound table (IE bug!)
Posted by:  Andrus Moor (nospam_eetasoft_@online.ee)
Date: Tue, 15 Jul 2003

To reproduce:  run the following code in IE 6 and right-click in table.

Observed result: Error : invalid argument  at line var row =
table.insertRow(0);

Expected result: new row must be inserted.

Any idea how to add new row to beginning of data-bound table ?

Code to reproduce:

<script>
function addRowDOM (tableID) {
var table = document.getElementById(tableID);

// Next line causes error: invalid argument. Why ?
var row = table.insertRow(0);
var cell = row.insertCell(0);
cell.innerHTML = arguments[1];
}

</script>

<xml id="result" javaDSOCompatible="true"><result>
<row><item>pine</item></row>
<row><item>apple</item></row>
</result></xml>

<TABLE DATASRC="#result" id=tbl >

<tr  oncontextmenu="addRowDOM('tbl','<input type=text datafld=item>');return
false;">
<td><input type=text datafld=item></input></td>
</tr></TABLE>

Replies