Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-17-2011, 04:34 PM   PM User | #1
neelesh.kalani
New Coder

 
Join Date: May 2011
Posts: 28
Thanks: 2
Thanked 0 Times in 0 Posts
neelesh.kalani is an unknown quantity at this point
swapNode equivalent in firefox

Do we have any equivalent of swapNode method in firefox?
neelesh.kalani is offline   Reply With Quote
Old 06-17-2011, 07:49 PM   PM User | #2
mrhoo
Regular Coder

 
Join Date: Mar 2006
Posts: 708
Thanks: 30
Thanked 127 Times in 118 Posts
mrhoo will become famous soon enoughmrhoo will become famous soon enough
// You can write your own function and pass both nodes as arguments.


Code:
function swap(a, b){
	var pa1= a.parentNode, pa2= b.parentNode, sib= b.nextSibling;
	if(sib=== a) sib= sib.nextSibling;
	pa1.replaceChild(b, a);
	if(sib) pa2.insertBefore(a, sib);
	else pa2.appendChild(a);
	return true;
}

Last edited by mrhoo; 06-17-2011 at 07:52 PM..
mrhoo is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:16 PM.


Advertisement
Log in to turn off these ads.