JavaScript Reference/Javascript Methods/insertAdjacentElement

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

"insertAdjacentElement()" Example

   <source lang="javascript">
   

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

var myElement = document.createElement("
");
  document.all.myButton.insertAdjacentElement("afterEnd", myElement); 

} </script> <button id="myButton" onclick="function1();">Insert element</button> </body> </html>


     </source>
   
  


"insertAdjacentElement()" 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>

        "insertAdjacentElement()" Syntax, Parameters and Note

        <source lang="javascript"> Note: Inserts an element in the specified position.

        Syntax:

        document.all.elementID.insertAdjacentElement(param1, param2) Parameters: param1 Required; beforeBegin just before the beginning of the element afterBegin just after the beginning of the element beforeEnd just before the end of the element afterEnd just after the end of the element param2 Required; the element to be inserted.


        </source>

      <textarea> | | |<tfoot> |

      | |<thead> <title> |

      | |