1、循环页面的CKEDITOR控件
for (var instance in CKEDITOR.instances) {
var oldContent = CKEDITOR.instances[instance].getData(); //内容
var selection = CKEDITOR.instances[instance].getSelection(); //选中内容
CKEDITOR.instances[instance].insertHtml(“新内容”);//赋值
}
2、通过ID取值
var content = CKEDITOR.instances.name.getData();
page:<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>
<CKEditor:CKEditorControl ID="name" runat="server" ></CKEditor:CKEditorControl>
3、添加功能控件:
CKEDITOR.plugins.add('linkcontent', {
lang:['zh-cn'],
requires: ['dialog'],
init: function(editor){
// Add the link and unlink buttons.
editor.addCommand('linkcontent', new CKEDITOR.dialogCommand('linkcontent'));
editor.ui.addButton('Linkcontent', {
label: editor.lang.tbTip,
icon: this.path + 'images/link.png',
command: 'autolink'
});
CKEDITOR.dialog.add('linkcontent', this.path + 'dialogs/linkcontent.js');
}
});