JavaScript Reference/Javascript Properties/contentEditable

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

"contentEditable" Example

   <source lang="javascript">
   

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

   myP.innerText = "Try to edit this text by overwriting any part of it.";
   document.all.myP.contentEditable = "true"; ]

} function function2() {

   myP.innerText = "Try again.";
   document.all.myP.contentEditable = "false"; 

} function function3(){

   alert(document.all.myP.isContentEditable);

} </script>

Try to edit this text by overwriting any part of it.

<button onclick="function1();">Make the text editable</button> <button onclick="function2();">Make the text non-editable</button> <button onclick="function3();">isContentEditable</button> </body> </html>


     </source>
   
  


"contentEditable" is applied to

   <source lang="javascript">

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

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

| | | | |<custom>

| | |defaults | | | <dir> |

| |
|

| |

| | |<fieldset> | | |<form> <hn> | | | <input type="button"> | | |<input type="password"> <input type="radio"> | | |<input type="reset"> <input type="submit"> | | |<input type="text"> | | |<isindex> | | |<label> <legend> |

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

      <plaintext> | | |

                                                            |
      |                |                                                    |
      |                |                                                     |
      |                |                                                 |
      |                |                                              |
      |                |                                                    |
      |                |<textarea>                                                |
      |                |                             
        | | | <xmp> | +----------------+--------------------------------------------------------------+ </source>

        "contentEditable" Possible Values

        <source lang="javascript"> Possible Values true false.


        </source>



        "contentEditable" Syntax and Note

        <source lang="javascript"> Note: Read and write property. Can the element content be modified.

        Syntax:

        document.all.elementID.contentEditable = value


        </source>