1、复制fckeditor到工程下
2、在需要添加fckeditor的页面中加入fckeditor的js文件
<script type="text/javascript" src="../fckeditor/fckeditor.js"></script> <!--载入fckeditor类-->
3、页面加载时创建(显示)编辑器
<script type="text/javascript">
window.onload = function () {
var oFCKeditor = new FCKeditor('FCKeditor1');
oFCKeditor.Width = "100%";
oFCKeditor.Height = "400";
oFCKeditor.BasePath = "../FCKeditor/";
oFCKeditor.ReplaceTextarea();
}
</script>
4、javascript读取fckeditor的值
function f_save()
{
var oEditor = FCKeditorAPI.GetInstance('FCKeditor1');
$("#Content").val(escape(oEditor.GetHTML()));
}
5、javascript给fckeditor赋值
function FCKeditor_OnComplete(){
var oEditor = FCKeditorAPI.GetInstance("FCKeditor1");
oEditor.SetHTML(unescape(document.getElementById("Content").value));
}
FCKeditor_OnComplete是编辑器自己加载完之后自己调用的,这样可以防止出现"this.EditingArea为空或不是对象"的错误。