"John Geddes" <jo**@starmarkassociates.co.uk> wrote in message
news:70**************************@posting.google.c om...
In both IE6 and Netscape 7:
insertRow method of tbody is behaving as expected:
- inserts a new row
- increases tbody.rows.length
BUT deleteRow is not doing the opposite.
It DOES delete the row, but it adds a <TR></TR> pair just before the
</TBODY> and that leaves the tbody.rows.length count unchanged.
Demo page at http://www.btinternet.com/~geddes.winster/drtable.htm
Snippet of your code:
function delRow(tabName){
var thisBody=document.getElementById(tabName);
var origLength=thisBody.rows.length;
var tr= thisBody.insertRow(thisBody.rows.length); //Why this?
var rowNo=document.aForm.t1.value;
if (thisBody.rows[rowNo]){
thisBody.deleteRow(rowNo);
var tb2=document.getElementById(tabName);
alert("attempted to delete row index="+ rowNo+ " from
"+tabName+String.fromCharCode(10)+"rowCount changed from "+origLength+" to
"+thisBody.rows.length+String.fromCharCode(10)+"CH ECK length with redefined
tbody: "+tb2.rows.length);
} else {
alert("no row in "+tabName+"with index "+rowNo);
}
}
Try get rid of statement:
var tr= thisBody.insertRow(thisBody.rows.length);