21,894
社区成员




var oFormat168Item = new FCKToolbarButton('Format168', FCKLang.Format168Btn); //设置按钮的图标路径
oFormat168Item.IconPath = FCKPlugins.Items['formatcommands'].Path + 'placeholder.gif'; //注册按钮项
FCKToolbarItems.RegisterItem('Format168', oFormat168Item); // The object used for all Format168 operations.
var FCKFormat168 = new Object(); FCKFormat168 = function(name){ this.Name = name; } //FCK_TRISTATE_ON为默认是选中状态 下面的两个方法是实现接口的两个必须的方法,否则会报脚本错误
FCKFormat168.prototype.GetState = function() { return FCK_TRISTATE_OFF; } //此方法是点击按钮后要完成的操作
FCKFormat168.prototype.Execute = function(){ FormatText(); }
//以下都是实现功能的方法
function FormatText() {
var oEditor = FCKeditorAPI.GetInstance('content') ;
var html = oEditor.EditorDocument.body.innerText;
alert(html);
} ;
// Register the related command
FCKCommands.RegisterCommand('Format168', new FCKFormat168('Format168'));
for ( var name in FCKeditorAPI.Instances ){var oEditor = FCKeditorAPI.Instances[ name ]
<input type=button name=btnSubmit value="显示" onClick="showcont()">
function showcont(){
var oEditor = FCKeditorAPI.GetInstance('content'); //name值
var checkContent = oEditor.GetXHTML(); //获取FCKeditor里面的内容
alert(checkContent);
}
include_once(ROOT_PATH . 'includes/fckeditor/fckeditor.php'); // 包含 html editor 类文件
$input_name='content';//name值
$input_value='内容';//value
$editor = new FCKeditor($input_name);
$editor->BasePath = '../includes/fckeditor/';
$editor->ToolbarSet = 'Normal';
$editor->Width = '100%';
$editor->Height = '320';
$editor->Value = $input_value;
$FCKeditor = $editor->CreateHtml();
echo $FCKeditor;//FCKeditor页