Removing Table Rows in JS Javascript
I've got a function to remove a number of rows from the end of my table. It works fine in Opera 9 but FF can't seem to get the number of rows of the table correctly.
Basically if I add new rows the tbl.rows.length in FF doesn't take account of these new dynamic rows and just returns how many rows were in the table when the page began (I don't think there are any syntax errors in the table).
function remove_row()
{
var tbl = document.getElementById('dt');
var lastRow = tbl.rows.length;
tbl.deleteRow(lastRow-1);
lastRow--;
tbl.deleteRow(lastRow-1);
lastRow--;
tbl.deleteRow(lastRow-1);
lastRow--;
tbl.deleteRow(lastRow-1);
lastRow--;
tbl.deleteRow(lastRow-1);
lastRow--;
return true;
}
[940 byte] By [
Nibinaear] at [2007-11-20 7:01:30]

# 3 Re: Removing Table Rows in JS Javascript
Javascript supports both prefix/postfix increment/decrement operators.
When did this support get added? I have had variable-- fail in JavaScript in Safari, Firefox, and IE within the last 1.5 years.
# 4 Re: Removing Table Rows in JS Javascript
When did this support get added? I have had variable-- fail in JavaScript in Safari, Firefox, and IE within the last 1.5 years.
I think I'll try is anyway, whatever the documentations say. Seems like basic functionality to not include though, I'd say that's a part of every programming language, Java, C++, Perl, Php, anything! And Pjavery, not everything I get wrong in Javascript has to do with whatever I know in PHP.
# 5 Re: Removing Table Rows in JS Javascript
And Pjavery, not everything I get wrong in Javascript has to do with whatever I know in PHP.
I never insinuated that. I was just simply tying it back to PHP since that is probably the most common scripting language next to JavaScript. And since all scripting languages have some hint of commonality, I just thought I would point that difference out.
# 6 Re: Removing Table Rows in JS Javascript
I never insinuated that. I was just simply tying it back to PHP since that is probably the most common scripting language next to JavaScript. And since all scripting languages have some hint of commonality, I just thought I would point that difference out.
That's fine, lets not have any more run-ins.
# 7 Re: Removing Table Rows in JS Javascript
That's fine, lets not have any more run-ins.
That would be highly prefered. :D