DHTML Methods
Exchanges the location of two objects in the document hierarchy.
object.swapNode ( oNode )
oNode |
Required. Specifies an element. |
No return value.
The following sample demonstrates the use of the swapNode method to exchange the location of two objects.
<script language="JavaScript">
function fnSwap ( ) {
oList.children ( 0 ).swapNode ( oList.children ( 1 ) );
}
</script>
<UL ID = oList>
<LI>List Item 1
<LI>List Item 2
<LI>List Item 3
<LI>List Item 4
</UL>
<input TYPE = button VALUE = "Swap List"
onclick = "fnSwap ( ) ">