http://nightly.ckeditor.com/4303/_samples/divreplace.html
<head>
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<style id="styles" type="text/css">
div.editable
{
padding-left: 15px;
padding-right: 15px;
}
div.editable:hover
{
border-color: black;
}
</style>
<script id="headscript" type="text/javascript">
//<![CDATA[
// Uncomment the following code to test the "Timeout Loading Method".
// CKEDITOR.loadFullCoreTimeout = 5;
var editor;
window.onload = function()
{
// Listen to the double click event.
if ( window.addEventListener )
document.body.addEventListener( 'dblclick', onDoubleClick, false );
else if ( window.attachEvent )
document.body.attachEvent( 'ondblclick', onDoubleClick );
};
function onDoubleClick( ev )
{
// Get the element which fired the event. This is not necessarily the
// element to which the event has been attached.
var element = ev.target || ev.srcElement;
// Find out the div that holds this element.
element = element.parentNode;
if ( element.nodeName.toLowerCase() == 'div'
&& ( element.className.indexOf( 'editable' ) != -1 ) )
replaceDiv( element );
}
function replaceDiv( div )
{
if ( editor )
editor.destroy();
editor = CKEDITOR.replace( div );
}
//]]>
</script>
</head>
<body>
<?php
echo($_POST['editable']);
?>
<form method="post">
<div class="editable">
<p>
testing
</p>
</div>
<input type="submit" />
</form>
</body>
</html>
