在IE下,可以用
return(oEditor.EditorDocument.body.innerText);
来获取fckeditor的值。或者var oEditor = FCKeditorAPI.GetInstance('content');
return (oEditor.GetXHTML(false));
上面2行为获取html的内容即源码。但提交的时候如果遇到例如&之类的字符,就被截断了。所以不用这个方法。第1种方法,在火狐下会提示 undefined。无法取到值
如果在火狐下用:
return(oEditor.EditorDocument.body.innerHTML);//;
会把fckeditor的源码也取下来了。
有什么办法可以在火狐下取得fckeditor里的文本或源码?
谢谢。
return(oEditor.EditorDocument.body.innerText);
来获取fckeditor的值。或者var oEditor = FCKeditorAPI.GetInstance('content');
return (oEditor.GetXHTML(false));
上面2行为获取html的内容即源码。但提交的时候如果遇到例如&之类的字符,就被截断了。所以不用这个方法。第1种方法,在火狐下会提示 undefined。无法取到值
如果在火狐下用:
return(oEditor.EditorDocument.body.innerHTML);//;
会把fckeditor的源码也取下来了。
有什么办法可以在火狐下取得fckeditor里的文本或源码?
谢谢。
用IE8测试是正常的。
用这个方法,只取文本:return(oEditor.EditorDocument.body.innerText);
因为考虑到要用ajax方式提交数据。所以不能获取html源码,否则遇到 & 字符,post过去后获取post的内容就会被截断。但是这个innerText在火狐下不识别。得到的结果是 undefined
而如果用innerHTML的话,会把fckeditor编辑器的源码也一起取过来了。
太晚了我犯迷糊了?
明天再看下情况。解决了就结贴。
于是修改,当ie下的时候用innerHtml火狐下的时候用textContent
修改后的代码如下
var oEditor = FCKeditorAPI.GetInstance(EditorName);//这里的EditorName是你的编辑器所产生的编辑界面名称
var foraspcn = document.all?oEditor.EditorDocument.body.innerText:oEditor.EditorDocument.body.textContent;这样就完美解决了。