Imagine you have a form in which you use FCKEditor as an inline HTML editor. So, inside script
tag you have this:
var oFCKeditor = new FCKeditor('body_html'); oFCKeditor.BasePath = "A_PATH_TO_FCKEDITOR"; oFCKeditor.ToolbarSet = "Basic"; oFCKeditor.Create();
As you know, this creates a textarea with id set to ‘body_html’ and make it look like an inline HTML editor.
Going forward, you would like to receive the HTML code that represents the content of this textarea, and that you want to do this in JavaScript. In order to do that you need to follow FCKEditor API, so do somethink like this:
FCKeditorAPI.GetInstance('body_html').GetHTML(true);
Maybe it’s obvious but it took my a while to find out how to do this…
Thank you so much for publishing this post.
I’ve had the same problem and spent hours trying to find a solution without success.
I read your post, tried out what you said, and it worked!
Thank you
Sir,
Thanks for the sample; however it only works for an alert; e.g.
If I attempt to assign the output of getHTML to a JS variable, I get the error, Object doesn’t support this property or method.
Thoughts?
Thanks!
Robert in Vermont
Rob,
Did you try this one: http://dobrzanski.net/2008/06/11/microsoft-jscript-runtime-error-object-doesnt-support-this-property-or-method/ ?
Cheers,
Jarek
Jarek,
Good reading, but it turned out to be my misuse of the FCKEditor JS API. It should have been:
FCKeditorAPI.GetInstance(‘body_html’).GetHTML(false);
…instead of:
FCKeditorAPI.GetInstance(‘body_html’).GetHTML(true);
The documentation for this API doesn’t really explain the function of that parameter.
Over this mountain and on to the next !
Cheers,
Rob
Thanks for your opinion, but my dear it doesn’t work with HTML values…….
You are Great, keep the good work !!
Thanks for this!!! You are a life saver!!
I used this solution, but I have crashed IE other browses is OK.
Anyone knows about this problem?
Sorry my English