// 获取编辑器中HTML内容
function getEditorHtmlContents(name,isClearP){
//获取多文本编辑框的对象
var oEditor = FCKeditorAPI.GetInstance(name);
//获取用户输入的内容
var acontent = oEditor.GetXHTML();
if(isClearP){
//过滤掉多文本编辑框增加的<p></p>
acontent=acontent.substr(3,acontent.length-7);
}
return acontent;
}
// 获取编辑器中文字内容
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) ;
}
function getEditorHtmlContents(name,isClearP){
//获取多文本编辑框的对象
var oEditor = FCKeditorAPI.GetInstance(name);
//获取用户输入的内容
var acontent = oEditor.GetXHTML();
if(isClearP){
//过滤掉多文本编辑框增加的<p></p>
acontent=acontent.substr(3,acontent.length-7);
}
return acontent;
}
// 获取编辑器中文字内容
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) ;
}
本文介绍如何使用 FCKeditor 的 API 来获取和设置编辑器中的 HTML 和纯文本内容。通过具体函数如 getEditorHtmlContents, getEditorTextContents 和 SetEditorContents, 读者可以了解如何在 Web 开发中有效地利用这些功能。
1780

被折叠的 条评论
为什么被折叠?



