Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #18548
| Newsgroups | comp.lang.javascript |
|---|---|
| Subject | Re: Node removal problem |
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
| References | (2 earlier) <84c1fef2-67e4-4274-9436-2bc85723a22e@googlegroups.com> <511fd40e$0$6555$9b4e6d93@newsspool4.arcor-online.net> <e1a443e1-1eb6-48ee-8fb8-65f74ab18529@googlegroups.com> <170411d6-6149-469f-8e80-3d8bf5baaa9c@googlegroups.com> <51223322$0$1373$ba4acef3@reader.news.orange.fr> |
| Date | 2013-02-18 22:05 +0100 |
| Message-ID | <XnsA16BE0C04FE71eejj99@194.109.133.133> (permalink) |
SAM wrote on 18 feb 2013 in comp.lang.javascript:
> Le 16/02/13 22:25, justaguy a écrit :
>> We're getting there. Previously your code covers two levels (td and
>> its tr), we need three levels, current TD, its TR, and the TR's
>> parent. With revised code, it solves one problem. I also have
>> dynamically generated TRs and TDs, such as
>> var newrow = document.createElement("tr");
>> var cell = document.createElement("td");
>> var cellText = document.createElement('input');
>> cellText.type = 'checkbox';
>> ... set other attributes
>> cell.appendChild(cellText);
>> newrow.appendChild(cell);
>> cell.onclick = "var row = this.parentNode;
>
> You can't be sure that the parentNode will be a row
Yes, you can.
>> var tdParent = row.parentNode;
>
> That's to say that we expect to get now a TBODY or a TABLE (*)
Always a <tbody> or a <thread> or <tfoot> is specified.
If not specified the <tbody> is inserted for you in the DOM.
> var trParent = tdParent.parentNode;
>
> We aren't sure we got the right element (the table)
Then you should test it in all different browsers.
> trParent.removeChild(tdParent);"
>
> OK
> if we got the good element !
If you doubt, test.
>> /* the above line fails;
>> I attempted to use cellText.onclick as well, but to no avail
>> */
>
> As you make mistakes in nested tags of tables you will not get
> anything!
>
>> What am I not doing right? Thanks.
Seems you don't trust yourself and don't test, bad habit.
> The html isn't right !!!
>
> (*) the table containing the row to delete in the example you gave in
> one of your previous posts was "nowhere" (it wasn't in a TD).
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Node removal problem justaguy <lichunshen84@gmail.com> - 2013-02-16 10:09 -0800
Re: Node removal problem Martin Honnen <mahotrash@yahoo.de> - 2013-02-16 19:29 +0100
Re: Node removal problem justaguy <lichunshen84@gmail.com> - 2013-02-16 10:37 -0800
Re: Node removal problem justaguy <lichunshen84@gmail.com> - 2013-02-16 10:44 -0800
Re: Node removal problem Martin Honnen <mahotrash@yahoo.de> - 2013-02-16 19:46 +0100
Re: Node removal problem justaguy <lichunshen84@gmail.com> - 2013-02-16 11:10 -0800
Re: Node removal problem justaguy <lichunshen84@gmail.com> - 2013-02-16 13:25 -0800
Re: Node removal problem SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2013-02-18 14:56 +0100
Re: Node removal problem "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-02-18 22:05 +0100
Re: Node removal problem Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-02-16 23:05 +0100
Re: Node removal problem justaguy <lichunshen84@gmail.com> - 2013-02-16 14:44 -0800
Re: Node removal problem Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-02-16 23:51 +0100
Re: Node removal problem justaguy <lichunshen84@gmail.com> - 2013-02-16 15:19 -0800
Re: Node removal problem SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2013-02-17 02:46 +0100
Re: Node removal problem justaguy <lichunshen84@gmail.com> - 2013-02-16 17:59 -0800
Re: Node removal problem justaguy <lichunshen84@gmail.com> - 2013-02-16 18:44 -0800
Re: Node removal problem justaguy <lichunshen84@gmail.com> - 2013-02-16 19:08 -0800
Re: Node removal problem justaguy <lichunshen84@gmail.com> - 2013-02-16 19:54 -0800
Re: Node removal problem SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2013-02-18 14:41 +0100
Re: Node removal problem SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2013-02-18 13:07 +0100
Re: Node removal problem "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-02-18 14:29 +0100
Re: Node removal problem "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-02-18 14:36 +0100
Re: Node removal problem SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2013-02-18 15:13 +0100
Re: Node removal problem SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2013-02-18 15:05 +0100
Re: Node removal problem "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-02-18 22:01 +0100
csiph-web