最近在项目中用到FCK和ajax出现了一些问题.
首先,无法页面中获取FCK内的内容.解决方法是在验证参数前加入以下代码:
var oEditor = FCKeditorAPI.GetInstance("content") ;//Content是fck实例的名称,也是表单文本框的名称
oEditor.UpdateLinkedField();
这是会将FCK内的内容填充至文本框中,可以直接用document.getElementById("content").value获取内容.
在保存成功后,需要将已保存的内容清空,所以需要以下代码清除内容.
var editor = FCKeditorAPI.GetInstance("FCKeditor1");
editor.EditorDocument.body.innerHTML="";