Chinaunix首页 | 论坛 | 博客
  • 博客访问: 37405
  • 博文数量: 14
  • 博客积分: 1410
  • 博客等级: 上尉
  • 技术积分: 150
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-14 13:14
文章分类

全部博文(14)

文章存档

2008年(14)

我的朋友

分类: 系统运维

2008-11-10 15:07:37

在js中引用Fckeditor:
window.onload = function(){
        var oFCKeditor = new FCKeditor( 'editor' ) ;
        oFCKeditor.BasePath    = '../js/fckeditor/' ;
        oFCKeditor.ToolbarSet    = 'zjc' ;
        oFCKeditor.Height=400;
        oFCKeditor.Width=550;
        oFCKeditor.ReplaceTextarea() ;
}

Fckeditor默认有三种皮肤:default、office2003和silver
设置皮肤:
   打开fckeditor下的fckconfig.js
      找到FCKConfig.SkinPath = FCKConfig.BasePath + 'skins/default/' ;
         修改default为office2003或silver。
这样皮肤就修改成功了(注意:skins目录在editor下,配置path的时候不需要加上这个目录)。

自定义工具栏:
同样在fckeditor下找到fckconfig.js
   找到FCKConfig.ToolbarSets[""]=[];
在fckconfig中已经存在两个工具栏样式Default和Basic.
Default的功能最全面,代码如下:
 FCKConfig.ToolbarSets["Default"] = [
    ['Source','DocProps','-','Save','NewPage','Preview','-','Templates'],
    ['Cut','Copy','Paste','PasteText','PasteWord','-','Print','SpellCheck'],
    ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],       ['Form','Checkbox','Radio','TextField','Textarea','Select','Button','ImageButton','HiddenField'],
    '/',
    ['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],
    ['OrderedList','UnorderedList','-,'Outdent','Indent','Blockquote','CreateDiv'],
    ['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
    ['Link','Unlink','Anchor'],
    ['Image','Flash','Table','Rule','Smiley','SpecialChar','PageBreak'],
    '/',
    ['Style','FontFormat','FontName','FontSize'],
    ['TextColor','BGColor'],
    ['FitWindow','ShowBlocks','-','About']
] ;

可以把工具栏想象为是一个数组,每一对[]中存放的所一个工具的集合,在工具栏上显示为一个竖立的分割符(看工具栏最前面)。每一对[]之间以逗号(,)分开。在同一个[]中,可以使用'-'形成竖立的分割符(和前面的不一样),每个功能按钮与数组中的''对应。如果工具栏还行,使用'/'符号。
举例如下(下面是定义的一个只处理文字的工具栏):

FCKConfig.ToolbarSets["zjc"] = [
    ['Bold','Italic','Underline','TextColor','Image','Smiley','-,'Link','Unlink'], 
     ['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
    '/',
     ['FontFormat','FontName','FontSize']
] ;



阅读(1294) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2009-05-20 16:15:53

自定义的工具栏好像不能用啊!!!只能用Default和Basic啊!为什么啊????