[Javascript] removeChild() ???

Mikael Lindström mikael.lindstrom at nipsoft.se
Thu Jan 31 05:43:16 CST 2002


Well...nevermind.

Iwanted to remove the childs of the td:s and it didn't work.

The problem appeared to be that cause some of the childs existed due to
cloneNode-method and that apparently gives a reference to the cloned Node.

And that, thank you MSDN, is not the same as "method returns a copy of node"

MSDN really sucks sometimes ...

Regards

Michael

> -----Original Message-----
> From: javascript-admin at LaTech.edu
> [mailto:javascript-admin at LaTech.edu]On
> Behalf Of Peter-Paul Koch
> Sent: Thursday, January 31, 2002 11:46 AM
> To: javascript at LaTech.edu
> Subject: Re: [Javascript] removeChild() ???
>
>
>
>
>
> >I have the following code:
> >   var oTD = document.all.tags("TD");  //Every TD contains
> one or more DIVS
> >(only)
> >
> >   alert('#childs before delete: ' +oTD[0].children.length);
> >
> >   oTD[iCnt].removeChild(oTD[iCnt].children(iTmp_01));
> >
> >   alert('#childs after delete: ' +oTD[iCnt].children.length);
> >
> >My problem is that I dont understand why, help me god,
> >oTD[iCnt].children.length most of the times return same
> number before as
> >after, meaning ... I cannot remove elements as I want to.
> >
> >Help me please ...
>
> What do you want to remove? The children of the TD's or the
> TD's themselves?
> Does the script have to remain IE-only?
>
> See http://www.xs4all.nl/~ppk/js/index.html?version5.html for more
> information about removeChild/removeNode and children/childNodes.
>
> ppk
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at
> http://explorer.msn.com/intl.asp.
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
>





More information about the Javascript mailing list