js获取ckeditor的值

来源:岁月联盟 编辑:exp 时间:2012-02-24

第一步,在ckeditor_php5.php中修改:

if (!empty($_config))
$js .= “CKEDITOR.replace(‘”.$name.”‘, “.$this->jsEncode($_config).”);”;
else
$js .= “CKEDITOR.replace(‘”.$name.”‘);”;
if (!empty($_config)) $js .= “var editor=CKEDITOR.replace(‘”.$name.”‘, “.$this->jsEncode($_config).”);”; else $js .= “var editor=CKEDITOR.replace(‘”.$name.”‘);”;

修改成:

if (!empty($_config))

$js .= “var editor=CKEDITOR.replace(‘”.$name.”‘, “.$this->jsEncode($_config).”);”;

else

$js .= “var editor=CKEDITOR.replace(‘”.$name.”‘);”;

第二步:

用下面的方法取值.


editor.document.getBody().getText(); //取得纯文本

editor.document.getBody().getHtml(); //取得html文本


摘自 顺子网络 PHP网站建设