Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) in /var/www/smokinggun/live/lib/sg_main.php on line 260

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /var/www/smokinggun/live/lib/sg_main.php on line 262
durring an attempt to connect smokinggun | SOURCE CODE smokinggun source code
back to Code | back to Home
Swaps two DOM objects.

Info | Source
sg_swapNode source
	
	view source for the JS code
	
	
Info Swaps object0 with object1.

This was meant as a solution to IE for Windows proprietary swapNode method.

Note: Events are not cloned. You will need to add event cloning to this, if required.
Could use better error detection.

Syntax
sg_swapNode(object0,object1);
nObject0 = sg_swapNode(object0,object1); //will return the cloned object0
Example
objA = document.getElementById("obj0");
objB = document.getElementById("obj1");
sg_swapNode(objA,objB);
/* or */
t = sg_swapNode(objA,objB);

swap 0 & 1 | swap 0 & 2

0
1
2
3