'contentEditable' Example : contentEditable « Javascript Properties « JavaScript Reference

'contentEditable' Example

<!-- 
Example revised from 

The Web Programmer's Desk Reference
by Lazaro Issi Cohen and Joseph Issi Cohen 

ISBN: 1593270119
Publisher: No Starch Press 2004
-->    
<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>
<p id="myP">Try to edit this text by overwriting any part of it.</p>
<button onclick="function1();">Make the text editable</button>
<button onclick="function2();">Make the text non-editable</button>
<button onclick="function3();">isContentEditable</button>
</body>
</html>

    
      
      








Related examples in the same category

1.'contentEditable' Syntax and Note
2.'contentEditable' Possible Values
3.'contentEditable' is applied to