当前位置:首页 > 计算机相关 > JS专区 > 正文内容

lotus domino下使用FCKeditor

piikee14年前 (2010-07-15)JS专区571
lotus domino下使用FCKeditor,有两种插入方法。
第一种(比较推荐的方法):
HTML首页内容里面加入
"<script type='text/javascript' src='/fck/fckeditor.js'></script>"
//注意路径别写错,FCK编辑器那个文件夹在哪里就写哪里,比如domino里面我把文件夹命名为fck,放入data/domino/html里面,所以这样写。
表单或页面里面用内置HTML写入
<script type ="text/javascript">
var oFCKeditor = new FCKeditor("FCKeditor1");
oFCKeditor.BasePath =  '/fck/'; //这里同上,设置FCK编辑器的目录
oFCKeditor.Create();
</script>
第二种方法(替换Textarea实现):
HTML首页内容里面加入
"<script type='text/javascript' src='/fck/fckeditor.js'></script>"
//注意路径别写错,FCK编辑器那个文件夹在哪里就写哪里,比如domino里面我把文件夹命名为fck,放入data/domino/html里面,所以这样写。
JS Header 里面写入
window.onload = function()
{
var sBasePath = '/fck/'; //这里修改为你网站的fck编辑器文件夹的相对路径
var oFCKeditor = new FCKeditor( 'FCKeditor1' ) ;
oFCKeditor.BasePath = sBasePath ;
oFCKeditor.ReplaceTextarea();
}
表单或页面里面用内置HTML写入
<textarea name="FCKeditor1" rows="10" cols="80" style="width: 100%; height: 200px"> </textarea>
//【此方法可以用FCK替换lotus的富文本域。lotus表单里面富文本域为FCKeditor1即可,然后富文本域两边加[
富文本域在这里

]就可以实现openDocument时显示样式而不是HTML代码了。(注意,是有“[]”的哦)】
另附两个获取FCK文本框内容的方法(EditorName传入FCKeditor的名字,比如上面的名字是FCKeditor1)
// 获取编辑器HTML内容
function getEditorHTMLContents(EditorName) {
var oEditor = FCKeditorAPI.GetInstance(EditorName);
return(oEditor.GetXHTML(true));
}
// 获取编辑器中文字内容
function getEditorTextContents(EditorName) {
var oEditor = FCKeditorAPI.GetInstance(EditorName);
return(oEditor.EditorDocument.body.innerText);
}
//【oEditor.GetXHTML(formatted); // formatted 为:true|false,表示是否按HTML格式取出
也可用:
oEditor.GetXHTML();】
// 获取编辑器中文字内容,必须用JQuery,兼容火狐和IE
getEditorTextContents(EditorName){
var oEditor = FCKeditorAPI.GetInstance(EditorName);
if($.browser.msie) val=$.trim(oEditor.EditorDocument.body.innerText); // IE
else if($.browser.mozilla) val=$.trim($(oEditor.EditorDocument.body).text());//非IE
return val;
}
给FCK赋值的函数
设置 FCK 编辑器的内容:
oEditor.SetHTML("content", false); // 第二个参数为:true|false,是否以所见即所得方式设置其内容。此方法常用于"设置初始值"或"表单重置。
插入内容到 FCK 编辑器:
oEditor.InsertHtml("html"); // "html"为HTML文本

扫描二维码推送至手机访问。

版权声明:本文由萍客小居[www.piikee.net]发布,如需转载请注明出处。

本文链接:https://www.piikee.net/650.html

分享给朋友:
返回列表

没有更早的文章了...

下一篇:一些JS事件

相关文章

JS实现广告顺序轮播和随机轮播四份代码

不多说,直接上代码:第一份顺序上滚(DIV遮罩滚动方法):广告时间,插点广告先:转载请注明来自【萍客小居http://www.piikee.net/】<html><head><STYLE type=text/c...

为FCK编辑器(FCKEditor)添加新按钮和功能

最近项目需要对已有的FCKeditor添加新的功能,以前的做法只是在外壳处再次封装,这次无法满足需求只能进行内部修改了。需要修改的文件:fckconfig.jszh-cn.jsen.jsfckeditorcode_gecko.js || f...

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。