JavaScript Reference/Javascript Properties/outerHTML

Материал из Web эксперт
Версия от 21:30, 25 мая 2010; (обсуждение)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

"outerHTML" Example

   <source lang="javascript">
   

<html> <body> <button type="button"

       style="border-width:thin; color:red; cursor:hand;" 
       onClick="function1();">
       Button. Repeat

</button>

<script language="JavaScript">

   function function1(){
       var m = event.srcElement;
       if(m.tagName != "p"){
           alert("Repeating the following HTML element:\n" + m.outerHTML);
           myD.innerHTML += m.outerHTML + "
"; } }

</script> </body> </html>


     </source>
   
  


"outerHTML" is applied to

   <source lang="javascript">

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

| |
|

| |
<button> |

| |
|

| | | | |<col> <colgroup> | | |<custom>

| | | |

| |<dir>
| | |
| | | <embed> | | |<fieldset> | | |<form> <frameset> | | |<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> |

| |
  • <listing> | | |<map> <marquee> | | |<menu> <nobr> | | |<object>
      | | |

      <plaintext> | | |

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

        "outerHTML" Syntax and Note

        <source lang="javascript"> Note: Read and write property. Sets all of the HTML content.

        Syntax:

        document.all.elementID.outerHTML = value


        </source>

      |

      | |<textarea> <tfoot> |

      | |
      <thead> | | |