[thelist] DOM, removing rows fun

Tom Dell'Aringa pixelmech at yahoo.com
Mon Sep 30 18:54:01 CDT 2002


--- "Means, Eric D" <eric.d.means at boeing.com> wrote:
> -----Original Message-----
> From: Tom Dell'Aringa [mailto:pixelmech at yahoo.com]
> Sent: Monday, September 30, 2002 5:40 PM
> To: thelist at lists.evolt.org
> Subject: [thelist] DOM, removing rows fun
>
> > I'm dynamically adding/removing rows in a table with the DOM. The
> > function below checks to see if the checkbox in the particular
> row is
> > checked - if it is, it whacks the row.
> >
> > The function works fine as far as removing the row. The problem
> is
> > that once that happens, it throws the while loop off, because the
> > number of rows has *changed* since I removed one.
>
> If you delete the row, don't increment the loop counter (or
> possibly
> decrement the limit condition, but I'd try not incrementing first).

> 			if(curCB.checked == true)
> 			{
> 				row =
> table.getElementsByTagName("TR").item(x);
> 				tbody.removeChild(row);
> 				numrows = numrows - 1;
> 			}
> 		}
> 		x = x + 1;

Doing the second suggestion kind of works, in fact if I only select
one in the list it works perfect. But when I select more than one, it
only gets me half.

I still think the way to do it whack them at the end...do you think
writing a dynamic array with the id's of the rows might work?

Tom

=====
var me = tom.pixelmech.webDeveloper();

http://www.pixelmech.com/
http://www.maccaws.com/
[Making A Commercial Case for Adopting Web Standards]

__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com



More information about the thelist mailing list