答案原址:http://www.phpchina.com/html/97/n-33197.html
利用Javascript取和设FCKeditor值也是非常容易的,如下:
EditorName是页面中可编辑区域元素的id比如:
<TEXTAREA id="texterea1" name="content" rows="30" cols="420"><c:out value="${content}"/></TEXTAREA>
EditorName就是texterea1了
// 获取编辑器中HTML内容
function getEditorHTMLContents(EditorName) {
var oEditor = FCKeditorAPI.GetInstance(EditorName);
return(oEditor.GetXHTML(true));
}
// 获取编辑器中文字内容
function getEditorTextContents(EditorName) {
var oEditor = FCKeditorAPI.GetInstance(EditorName);
return(oEditor.EditorDocument.b
获取FCKeditor编辑器内容的值 30 March 2010 13:50 Tuesday by 小屋 浏览(2648)
使用JS获取FCKEditor中的内容 30 November 2009 22:41 Monday by小屋 浏览(2010)
- // 获取FCKEditor中的内容: content为Editor实例的ID
- function getEditorContents(){
- var oEditor = FCKeditorAPI.GetInstance("content");
- alert(oEditor.GetXHTML(true));
- }
- // 向编辑器插入指定代码
- function insertHTMLToEditor(codeStr){
- var oEditor = FCKeditorAPI.GetInstance("content");
- if (oEditor.EditMode==FCK_EDITMODE_WYSIWYG){
- oEditor.InsertHtml(codeStr);
- }else{
- return false;
- }
- }
- // 统计编辑器中内容的字数