JavaScript Reference/Javascript Methods/swapNode

Материал из Web эксперт
Перейти к: навигация, поиск

"swapNode()" Example

   <source lang="javascript">
   

<html> <body> <script language="JavaScript"> function function1() {

   if (document.all) {
       var myNew = document.createElement("div");
       myNew.innerText = "This is a swapped element"
       myNew.style.color = "red"
       myDiv.swapNode(myNew);
   } 

} </script>

This is a div element

<input type="button" value="SwapNode" onClick="function1();"> </body> </html>


     </source>
   
  


"swapNode()" is applied to

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | Applied_To |<a> <acronym> | | |<address> <applet> | | |<area> | | |<base> <basefont> | | | <bgsound> |

| |
|

| |<body>
| | |<button> |

| |
|

| | <col> | | |<colgroup> <comment> | | |

| | | <dir> |

| |
|

| |

| | |<embed> <fieldset> | | | <form> | | |<frame> <frameset> | | |<head> <hn> |

| |
<html> |

| | <iframe> | | |<img> <input type="button"> | | |<input type="checkbox"> <input type="file"> | | |<input type="hidden"> <input type="image"> | | |<input type="password"> <input type="radio"> | | |<input type="reset"> <input type="submit"> | | |<input type="text"> | | | <label> |

| |<legend>
  • | | |<link> <listing> | | |<map> <marquee> | | |<menu> <object> | | |
      <option> | | |

      <plaintext> | | |

                                                            |
      |                |                                                     |
      |                |<script>                        <select>                      |
      |                |                                                 |
      |                |                                              |
      |                |                                                    |
      |                |                         <tbody>                       |
      |                |                          |
      |                |                             
        | | | <xmp> | +----------------+--------------------------------------------------------------+ </source>

        "swapNode()" Syntax, Parameters and Note

        <source lang="javascript"> Note: Swaps two nodes.

        Syntax:

        textNodeName.swapNode(param1) Parameters: param1 Required; one of the two nodes to exchange positions.


        </source>

      <textarea> | | |<tfoot> |

      | |<thead> <title> |

      | |