FCKeditor一些学习

本文介绍了FCKeditor富文本编辑器的两种初始化方式及其区别,探讨了如何通过临时字段解决异步提交的问题,并提供了设置默认换行符的方法。
(1)

1. var oEditer;
2.
3. function FCKeditor_OnComplete( editorInstance ){ //FCK加载完后自动运行函数,并将自己作为参数传入,可作初始化操作
4. oEditer = editorInstance;
5. }
6.
7. function submit(){
8. var textarea = oEditer.GetXHTML(true);
9. $("mainContent").value=textarea;
10. ........
11. }

(2)

1. <textarea name="mainContent" id="mainContent" style="display:none" > </textarea>
2. <textarea id="temp" value="<%=infoContent.getMainContent()%>" style="width:400px; height:400px;"></textarea>
3. <script type="text/javascript">
4. var objFckeditor = new FCKeditor("temp");
5. objFckeditor.Value = '' ;
6. objFckeditor.Height = '300' ;
7. objFckeditor.ReplaceTextarea();
8. </script>

(3)

1. <script type="text/javascript">
2. var objFckeditor = new FCKeditor("temp");
3. objFckeditor.Value = "<%=mainText==null?"":mainText%>" ;
4. objFckeditor.Height = '300' ;
5. objFckeditor.Create();
6. </script>

一,调用buffalo异步提交整个实体时会抛cannot find field [] for calss ............用一个temp过度。
二,2,3 都可作为初始化一个FCKeditor,
2中不能通过objFckeditor.Value设置初始值,可以在FCKeditor_OnComplete( editorInstance )函数中设置oEditer.SetHTML()方法设值,但有时会出JS脚本错误:没有权限
3中无此等麻烦推荐使用
三,FCK 中默认输入enter为<p>,输入shift+enter为<br>,通过修改fckconfig.js中
FCKConfig.EnterMode = 'br' ; // p | div | br
FCKConfig.ShiftEnterMode = 'p' ; 修改
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值