I'm trying to dynamically change a text area between the actual HTML, and the FCKEditor, based on a button being pushed. If I create a new FCKeditor every time, it works. But if I try to use FCKeditorAPI.GetInstance, the resulting object gives the javascript error: "fckeditor.CreateHTML is not a function". As far as my understanding goes, getInstance would return the same javascript object originally created by "oeditor=new FCKeditor", so I don't see why the CreateHTML method would suddenly disappear when I try to re-retrieve that object later.
If i do an alert after calling getInstance, the result says it IS an object, but I don't know how to get more details about what type of object or what methods are available to it.
If i do an alert after calling getInstance, the result says it IS an object, but I don't know how to get more details about what type of object or what methods are available to it.
//on button press, change the fckeditor to instead be a div displaying the html content
function showhtml()
{
document.getElementById("mydiv").innerHTML=FCKeditorAPI.GetInstance('myeditor').GetXHTML(true);
}
//on button press, change a div to a fckeditor
function showeditor() {
var fckeditor;
if(typeof(FCKeditorAPI)!="undefined" && typeof(FCKeditorAPI.GetInstance('myeditor))!="undefined")
{
fckeditor = FCKeditorAPI.GetInstance('myeditor'); //gets an object, but calling createHTML fails
}
else
{
fckeditor = new FCKeditor('myeditor');
//this works, and createHTML works only on the first button push
//if i ALWAYS do a new instance, the button works multiple times
}
document.getElementById("mydiv").innerHTML=fckeditor.CreateHtml();
}
