...

View Full Version : swapNode equivalent in firefox



neelesh.kalani
06-17-2011, 04:34 PM
Do we have any equivalent of swapNode method in firefox?

mrhoo
06-17-2011, 07:49 PM
// You can write your own function and pass both nodes as arguments.



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;
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum