1. 新建一个编辑器
Fckeditor使用手册Head:
Fckeditor使用手册
<script type="text/javascript" src="editor_path/fckeditor.js"></script>
Fckeditor使用手册
Fckeditor使用手册Html:
Fckeditor使用手册
<textarea id="content" name="content" style="width: 100%"></textarea>
Fckeditor使用手册
Fckeditor使用手册Javascript:
Fckeditor使用手册
var oFCKeditor = new FCKeditor('content');  // content为textarea的id
Fckeditor使用手册
oFCKeditor.BasePath = "../FCKeditor/"// editor跟路径
Fckeditor使用手册
oFCKeditor.Height = "100%"// 高度度设置
Fckeditor使用手册
oFCKeditor.Width = "100%"// 宽度度度设置
Fckeditor使用手册
oFCKeditor.ToolbarSet = "None"// 工具条设置
Fckeditor使用手册
oFCKeditor.Config["ToolbarStartExpanded"= false// 属性配置
Fckeditor使用手册
oFCKeditor.ReplaceTextarea();
Fckeditor使用手册
2. 操作编辑器
Fckeditor使用手册取得对象:
Fckeditor使用手册
var oEditor = FCKeditorAPI.GetInstance('content ');
Fckeditor使用手册
Fckeditor使用手册取得名字:
Fckeditor使用手册
var editorName = oEditor.Name;
Fckeditor使用手册
Fckeditor使用手册取得内容:
Fckeditor使用手册
var content =  oEditor.GetXHTML(true);
Fckeditor使用手册
Fckeditor使用手册设置内容:
Fckeditor使用手册oEditor.SetHTML(‘html’);
Fckeditor使用手册
Fckeditor使用手册插入内容到当前光标处:
Fckeditor使用手册oEditor.InsertHtml(‘html’);
Fckeditor使用手册
Fckeditor使用手册更新内容到textarea:
Fckeditor使用手册oEditor.UpdateLinkedField();
Fckeditor使用手册

 要点:
Fckeditor所有方法和属性的第一个单词的首字母都是大写

3. 有用事件


编辑器加载完毕后会自动调用名字为FCKeditor_OnComplete的函数,并将自身作为参数传递进去,一般在FCKeditor_OnComplete函数初始化编辑器

Fckeditor使用手册function FCKeditor_OnComplete(editorInstance)

相关文章: