方法正确,可以使用!
‍ //获取编辑器中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);
}
//设置编辑器中内容
function SetEditorContents(EditorName, ContentStr)
{
var oEditor = FCKeditorAPI.GetInstance(EditorName) ;
oEditor.SetHTML(ContentStr) ;
}
赋值:
Java代码
var oEditor = FCKeditorAPI.GetInstance('ncontent');
oEditor.SetHTML(“三菱电机法拉撕开对方”);
还有一个使用的是jquery来实现
jQuery FCKEditor插件取值、赋值
2008-12-13 16:51
第一步:导入需要的js文件(根据实际情况修改相应路径)
Java代码
<script src="../js/jquery.js" type=text/javascript></script>
<script src="../js/jquery.FCKEditor.js" type=text/javascript></script>
<script src="../fckeditor/fckeditor.js" type="text/javascript"></script>
<script src="../js/jquery.js" type=text/javascript></script>
<script src="../js/jquery.FCKEditor.js" type=text/javascript></script>
<script src="../fckeditor/fckeditor.js" type="text/javascript"></script>
第二步:初始化(根据实际情况修改相应路径)
Java代码
//初始化FCKEditor
$.fck.config = {path: '/这里是你的项目名称/fckeditor/', height: 400 ,toolbar:'Default'};
$('textarea#ncontent').fck();
//初始化FCKEditor
$.fck.config = {path: '/这里是你的项目名称/fckeditor/', height: 400 ,toolbar:'Default'};
$('textarea#ncontent').fck();
其中#ncontent为页面你所绑定的textArea的id或name
第三步:取值
Java代码
var getcontent = $.fck.content('ncontent', ''); //其中ncontent为页面你所绑定的textarea的id或name
var getcontent = $.fck.content('ncontent', ''); //其中ncontent为页面你所绑定的textarea的id或name
第四步:赋值(更新的时候先把原有的值赋给textarea)
Java代码
var oEditor = FCKeditorAPI.GetInstance('ncontent');
oEditor.SetHTML(data.news_add.na_newscontent);
http://hi.baidu.com/cicon/blog/item/37a42097b2dbdb7d55fb9684.html
分享到:
相关推荐
对于使用fckeditor编辑器的朋友是个不错应用,主要介绍的是js对fckeditor的取值与赋值操作,fckeditor是个不错的比较方便的扩展功能的编辑器。
javascript获取FCKeditor内容.txt
javascript获取FCKeditor内容
fckeditor的MVC版及js使用fckeditor的方法,初步的,深入的请自行研究
FCKeditor demo(用JS方式)
3.1 Js创建FCKeditor实例: 4 3.1.1 方法一:内嵌方法(推荐) 4 3.1.2 方法二:替换页面中的Textarea 5 3.1.3 方法三:适合于Ajax的调用方法 6 3.1.4 Js中FCKeditor对象的属性(集合)和方法 6 3.1.4.1 属性 6 3.1.4.2 ...
Fckeditor皮肤Fckeditor皮肤Fckeditor皮肤Fckeditor皮肤Fckeditor皮肤Fckeditor皮肤
<script type="text/javascript" src="/fckeditor/fckeditor.js"> 其中路径是可更改的 2,现在,FCKEDITOR类已经可以使用了.有两个方法在页面中建立一个FCKEDITOR编辑器: 方法1:内联方式(建议使用):在页面的FORM标记内...
FCKEditor使用帮助文档。FCKEditor使用帮助文档。FCKEditor使用帮助文档。FCKEditor使用帮助文档。
FCKeditor是一个专门使用在网页上属于开放源代码的所见即所得文字编辑器。它志于轻量化,不需要太复杂的安装步骤即可使用。它可和PHP、JavaScript、ASP、ASP.NET、ColdFusion、Java、以及ABAP等不同的编程语言相结合...
javascript获取FCKeditor内容.pdf
fckeditor3.6(java js 实例
NULL 博文链接:https://liujianguangaaa.iteye.com/blog/1002623
cuteEditor Fckeditor破解 使用示例 cuteEditor Fckeditor破解 使用示例
fckeditor主要文件,要了可以联系我哈。
fckeditor和使用方法,可以上传图片,flash
ASP.NET 文本编辑器 FCKeditor 使用方法详解 FCKeditor 是一个功能强大且流行的 ASP.NET 文本编辑器,提供了许多实用的功能,如格式化文本、插入图片、上传文件、创建表格等。下面将详细介绍如何使用 FCKeditor 在 ...
FCKeditor.Net_2.6.3.zip和FCKeditor-v2.6.3
FCKeditor应用在ASP.NET上,需要两组文件,一组是FCKeditor本身,另一个是用于ASP.NET的FCKeditor控件(分为1.1和2.0两个版本,这里使用2.0版本)。 1. 将FCKeditor加入到项目中 解压FCKeditor编辑器,得到...