Fckeditor使用手册_html

Head:

Fckeditor使用手册_html

<script type="text/javascript" src="editor_path/fckeditor.js"></script>

Fckeditor使用手册_html


Fckeditor使用手册_html

Html:

Fckeditor使用手册_html

<textarea id="content" name="content" style="width: 100%"></textarea>

Fckeditor使用手册_html


Fckeditor使用手册_html

Javascript:

Fckeditor使用手册_html

var oFCKeditor = new FCKeditor('content');  // content为textarea的id
oFCKeditor.BasePath = "../FCKeditor/"; // editor跟路径
oFCKeditor.Height = "100%"; // 高度度设置
oFCKeditor.Width = "100%"; // 宽度度度设置
oFCKeditor.ToolbarSet = "None"; // 工具条设置
oFCKeditor.Config["ToolbarStartExpanded"] = false; // 属性配置
oFCKeditor.ReplaceTextarea();

Fckeditor使用手册_html

2. 操作编辑器

Fckeditor使用手册_html

取得对象:

Fckeditor使用手册_html

var oEditor = FCKeditorAPI.GetInstance('content ');

Fckeditor使用手册_html


Fckeditor使用手册_html

取得名字:

Fckeditor使用手册_html

var editorName = oEditor.Name;

Fckeditor使用手册_html


Fckeditor使用手册_html

取得内容:

Fckeditor使用手册_html

var content =  oEditor.GetXHTML(true);

Fckeditor使用手册_html


Fckeditor使用手册_html

设置内容:

Fckeditor使用手册_html

oEditor.SetHTML(‘html’);

Fckeditor使用手册_html


Fckeditor使用手册_html

插入内容到当前光标处:

Fckeditor使用手册_html

oEditor.InsertHtml(‘html’);

Fckeditor使用手册_html


Fckeditor使用手册_html

更新内容到textarea:

Fckeditor使用手册_html

oEditor.UpdateLinkedField();

Fckeditor使用手册_html

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

3. 有用事件

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

Fckeditor使用手册_html

function FCKeditor_OnComplete(editorInstance)
...{
// init code
alert(editorInstance.Name) ;
}

---------------------------------------------
生活的意义并不是与他人争高下,而在于享受努力实现目标的过程,结果是对自己行动的嘉奖。
↑面的话,越看越不痛快,应该这么说:

生活的意义就是你自己知道你要做什么,明确目标。没有目标,后面都是瞎扯!

新博客 ​​​https://www.VuejsDev.com​​ 用于梳理知识点