ITeye博客

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

ericxu131 · 2008-03-21 13:17 · js & ajax & css & html · Markdown

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="打开编辑器" onclick="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

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。