Re: replaceNode
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: replaceNode

From: Anand <Anand.1s1521@no-mx.forums.yourdomain.com.au>
Date: Tue Jul 12 2005 - 01:19:10 CEST

Thanks for your replies.
I tried the method you suggested in the last reply. It was interesting
to note that, instead of the new node [var A = '<h2> New text </h2>';]
replacing the existing node, the existing node totally diappears from
the list.

I have attached part of Dom tree I am dealing with. I need to replace
one of the TR under 'questionmenu' and my variable has
'<tr><td><a href='http://www.kkk.com'>Question 2</a></td>'

I applied your method for this DOM str. The existing node disappears.
The other thing is, I seem to be having problem with 'tr' and 'td'. I
haven't tried your method but with other tags like 'h2',

var newnode = createElement();
newnode.innerHTML = A;
parent.replaceChild(newnode,existing_node);

works fine. With trs and tds, a small gap seems to have been placed
instead of the newone. When I check the innerHTML of newnode, it still
hold the actual value that I need to replace with. However, doesn't
work......

I am still to try outerHTML.

Thanks
Anand

+-------------------------------------------------------------------+
|Filename: dom.JPG |
|Download: http://www.highdots.com/forums/attachment.php?attachmentid=156|
+-------------------------------------------------------------------+

-- 
Anand
------------------------------------------------------------------------
Anand's Profile: http://www.highdots.com/forums/member.php?userid=72
View this thread: http://www.highdots.com/forums/showthread.php?t=1746467
Received on Tue Oct 18 02:54:34 2005