JavaScript Reference/Javascript Properties/innerText

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

"innerText" Example

   <source lang="javascript">
   

<html> <body>

Sample Text inside a p element

<button onclick="alert(myP.innerHTML);">InnerHTML</button> <button onclick="alert(myP.innerText);">InnerText</button> </body> </html>


     </source>
   
  


"innerText" is applied to

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | Applied_To |<a> <acronym> | | |<address> | | | |

| |
<body> |

| |<button> |

| |
|

| | <custom> | | |

| | | <dir> |

| |
|

| |<fieldset> | | |<form> <hn> | | |<html> | | |<iframe> | | | <label> |

| |<legend>
  • | | |<listing> <map> | | |<marquee> <menu> | | |<nobr>
      | | |<option>

      | | |<plaintext>

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

        "innerText" Syntax and Note

        <source lang="javascript"> Note: Read and write property. Specifies the text between the element opening and closing tags.

        Syntax:

        document.all.elementID.innerText = value


        </source>

      |

      | |<textarea> <tfoot> |

      | |
      <thead> | | |<title>