jsp中使用FCKeditor_2.6.4.zip详细步骤实例介绍。
首先,请下载这个版本.
3. 把FCKEditor内容导入到项目中
把FCKeditor_N.zip中的fckeditor文件夹复制到项目WebRoot中
4. 在网页上使用FCKEditor
4.1 在网面导入javascript
<script type=”text/javascript” src=”fckeditor/fckeditor.js”></script>
4.2 在页面上加入下载元素
<form>
<script type=”text/javascript”>
var oFCKeditor = new FCKeditor(‘FCKeditor1′);
oFCKeditor.BasePath = “<%=basePath%>/fckeditor/”;
oFCKeditor.Height=300;
oFCKeditor.Width=’80%’;
oFCKeditor.ToolbarSet=’Default’;
oFCKeditor.Create();
</script>
<input type=”submit” value=”提交”>
</form>
${param.FCKeditor1 }
5. 测试
通过后进入下一步
6. 修改工具栏
通过fckconfig.js实现
6.1 按钮含义
EditSource 显示HTML源代码
StrikeThrough 删除线
Save 保存
NewPage 新建空白页面
Superscrīpt 上标
Subscrīpt 下标
Preview 预览
JustifyLeft 左对齐
Cut 剪切
Copy 复制
Paste 粘贴
JustifyCenter 居中对齐
JustifyRight 右对齐
JustifyFull 两端对齐
PasteText 纯文本粘贴
InsertOrderedList 自动编号
PasteWord 来自Word的粘贴
InsertUnorderedList 项目符号
Print 打印
Outdent 减少缩进
SpellCheck 拼写检查
Indent 增加缩进
Find 查找
ShowTableBorders 显示表格线
Replace 替换
ShowDetails 显示明细
Undo 撤销
Form 添加Form动作
Redo 还原
Checkbox 复选框
SelectAll 全选
Radio 单选按钮
RemoveFormat 去除格式
Input 单行文本框
Link 插入/编辑 链接
Textarea 滚动文本框
RemoveLink 去除连接
Select 下拉菜单
Anchor 锚点
Button 按钮
Image 插入/编辑 图片
ImageButton 图片按钮
Table 插入/编辑 表格
Hidden 隐藏
Rule 插入水平线
Zoom 显示比例
SpecialChar 插入特殊字符
FontStyleAdv 系统字体
UniversalKey 软键盘
FontStyle 字体样式
Smiley 插入表情符号
FontFormat 字体格式
About 关于
Font 字体
Bold 粗体
FontSize 字体大小
Italic 斜体
TextColor 文字颜色
Underline 下划线
BGColor 背景色
6.2 修改
找开FCKConfig.ToolbarSets
大约在118行
自己定义一个toolbar
复制FCKConfig.ToolbarSets["Basic"] = [
['Bold','Italic','-','OrderedList','UnorderedList','-','Link','Unlink','-','About']
] ;
把Basic修改为MyToolbar
FCKConfig.ToolbarSets["MyToolbar"] = [
['Bold','Italic','-','OrderedList','UnorderedList','-','Link','Unlink'],
['Style','FontFormat','FontName','FontSize'],
['TextColor','BGColor','-','Smiley','-','FitWindow']
] ;
6.3 修改网页文件:
<form>
<script type=”text/javascript”>
var oFCKeditor = new FCKeditor(‘FCKeditor1′);
oFCKeditor.BasePath = “<%=basePath %>/fckeditor/”;
oFCKeditor.Height=300;
oFCKeditor.Width=’80%’;
oFCKeditor.ToolbarSet=’MyToolbar’;
oFCKeditor.Create();
</script>
<input type=”submit” value=”提交”>
</form>
把Default修改为MyToolbar
6.4 测试
7. 汉字字体
在fckconfig.js中大约 162 行,在前面加上中文字体
FCKConfig.FontNames = ‘黑体;宋体;隶书;Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana’ ;
如果显示的是乱的话,把fckeditor.js另存为unicode格式就行了
8. 修改表情图片
在fckconfig.js大约319行找到下几行代码
FCKConfig.SmileyPath = FCKConfig.BasePath + ‘images/smiley/msn/’ ;
FCKConfig.SmileyImages = ['regular_smile.gif','sad_smile.gif','wink_smile.gif','teeth_smile.gif','confused_smile.gif','tounge_smile.gif','embaressed_smile.gif','omg_smile.gif','whatchutalkingabout_smile.gif','angry_smile.gif','angel_smile.gif','shades_smile.gif','devil_smile.gif','cry_smile.gif','lightbulb.gif','thumbs_down.gif','thumbs_up.gif','heart.gif','broken_heart.gif','kiss.gif','envelope.gif'] ;
FCKConfig.SmileyColumns = 8 ;
FCKConfig.SmileyWindowWidth = 320 ;
FCKConfig.SmileyWindowHeight = 210 ;
如果要添加新的表情图片,首先将图片复制到指定的目录中,然后在FCKConfig.SmileyImages指定文件名就可以了
ortant; zoom: 1 !important; filter: none; font-size: 12px; line-height: normal; color: rgb(88, 95, 87); letter-spacing: 2px; text-align: -webkit-auto;” >