Tuesday, July 27, 2010

Another way to clear FCKeditor value in javascript

Another way to clear FCKeditor value in javascript.
===================================================
Here I am telling you another way that how can you only clear FCKeditor value in javascript.
Assuming the you are using PHP as a server type script.

<?php
include_once("FCKeditor/fckeditor.php") ;
$sBasePath = "FCKeditor/" ;
// instance name as FCKeditor1
$oFCKeditor = new FCKeditor('FCKeditor1') ; 
$oFCKeditor->BasePath = $sBasePath ;
$oFCKeditor->Value = "test data";
$oFCKeditor->Create() ;
?>

<input name="resetButton" type="button" title="Reset" onclick="doClear();"  value="Reset"/>
<script>
function doClear(){
     var MyFCKeditor___Frame=document.getElementById("FCKeditor1___Frame");
     MyFCKeditor___Frame.src="FCKeditor/editor/fckeditor.html?InstanceName=FCKeditor1&Toolbar=Default";
    return false;
}
</script>


Note that, use same name/id in javascript here I am using "FCKeditor1" as a name.

No comments:

Post a Comment