fckeditor编辑器的一些用法校验和加载

fckeditor编辑器其实是运行在一个iframe当中,所以常规的校验需要先通过fckeditor的api来进行连接后才能正常的进行操作。代码如下:

var oFCKeditor=FCKeditorAPI.GetInstance('content');
oFCKeditor.UpdateLinkedField();
alert(document.form[0].content.value);

 

在正常打开页面时如果加载完整的fck编辑器会使页面打开很慢,所以可以一开始通过以下方式变通。代码如下:

<TEXTAREA name="content" id="content" style="height=350;width=100%"></TEXTAREA>
<INPUT type="button" value="打开编辑器" οnclick="showFKCEditer(this);">

 

function showFKCEditer(show_ob)
 {
 var oFCKeditor = new FCKeditor('content') ;
 oFCKeditor.ToolbarSet = "MyBasic";
 oFCKeditor.Config['SkinPath'] = '<%=request.getContextPath()%>/components/fckeditor/' + 'editor/skins/office2003/' ;
 oFCKeditor.BasePath = '<%=request.getContextPath()%>/components/fckeditor/' ;
 oFCKeditor.Height = 350 ;
 //oFCKeditor.Width = '96%';
 oFCKeditor.Value = '' ;
 //oFCKeditor.Create() ; 
 oFCKeditor.ReplaceTextarea() ;
 var cur_tr=findFirstParentTR(show_ob);
 cur_tr.parentElement.removeChild(cur_tr);
 }

 

不过在使用fck的api要先引入它的fckeditor/fckeditor.js包biggrin

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值