请问,如何获取 FCKeditor 内容编辑框 里的文字? 
 不点提交的情况下  如何获取? 
 我在 fckeditor.html 里  <textarea id="eSourceField" dir="ltr" style="WIDTH: 100%; HEIGHT: 100%">直接加文字</textarea> 直接加文字也没显示出来 

解决方案 »

  1.   


    include_once(ROOT_PATH . 'includes/fckeditor/fckeditor.php'); // 包含 html editor 类文件$input_name='content';//name值
    $input_value='内容';//value
        $editor = new FCKeditor($input_name);
        $editor->BasePath   = '../includes/fckeditor/';
        $editor->ToolbarSet = 'Normal';
        $editor->Width      = '100%';
        $editor->Height     = '320';
        $editor->Value      = $input_value;
        $FCKeditor = $editor->CreateHtml();
    echo $FCKeditor;//FCKeditor页
      

  2.   


    <input type=button name=btnSubmit value="显示" onClick="showcont()">function showcont(){
     var oEditor = FCKeditorAPI.GetInstance('content');  //name值
     var checkContent = oEditor.GetXHTML(); //获取FCKeditor里面的内容
     alert(checkContent);
    }
      

  3.   

    既然知道了NAME值 JS 就很容易获取
      

  4.   

    刚刚试了楼上的方法  不行喔
    oEditor 是什么,我的JS方法是写在 fckeditorcode_ie.js 里的
      

  5.   

    在那个HTML里是这样的 
    <tr id="eWysiwyg">
    <td id="eWysiwygCell" height="100%" valign="top">
    <iframe id="eEditorArea" name="eEditorArea" height="100%" width="100%" frameborder="no" src="fckblank.html"></iframe>
    </td>
    </tr>
    我尝试用document.getElementById("eWysiwygCell").innerHTML=  是可以插入内容 但用 document.getElementById("eWysiwygCell").value 却是 undefined
      

  6.   

    晕,我的是写在具体引用页面的,oEditor是FCKeditor的js里面定义的
      

  7.   

    因为我需要在工具栏上增加按钮的,所以在fckeditorcode_ie.js 里写了,都弄了好几天了,唉
    能不能帮我看看,现在怎么获取
      

  8.   

    刚看了下
    fckeditorcode_ie.js里面有for ( var name in FCKeditorAPI.Instances ){var oEditor = FCKeditorAPI.Instances[ name ]oEditor就是FCKeditor对象
      

  9.   


    这是正确,btnSubmit 是你提交内容的按钮。//jquery   button是按钮的CLASS
    $(function(){
    $(".button").click(function(){
     var oEditor = FCKeditorAPI.GetInstance('shop_ad_content');  //name值
     var checkContent = oEditor.GetXHTML();        //获取FCKeditor里面的内容
     alert(checkContent);
     return false;
    });
    });参考http://www.dnbcw.com/biancheng/net/jhzc143106.html
      

  10.   

    结合你给的链接http://blog.csdn.net/goody9807/archive/2008/06/30/2597839.aspxfckplugin.js源码为var oFormat168Item = new FCKToolbarButton('Format168', FCKLang.Format168Btn); //设置按钮的图标路径 
    oFormat168Item.IconPath = FCKPlugins.Items['formatcommands'].Path + 'placeholder.gif'; //注册按钮项
    FCKToolbarItems.RegisterItem('Format168', oFormat168Item); // The object used for all Format168 operations. 
    var FCKFormat168 = new Object(); FCKFormat168 = function(name){     this.Name = name; } //FCK_TRISTATE_ON为默认是选中状态 下面的两个方法是实现接口的两个必须的方法,否则会报脚本错误 
    FCKFormat168.prototype.GetState = function() {          return FCK_TRISTATE_OFF; } //此方法是点击按钮后要完成的操作 
    FCKFormat168.prototype.Execute = function(){     FormatText(); } 
    //以下都是实现功能的方法 
    function FormatText() {
    var oEditor = FCKeditorAPI.GetInstance('content') ;
    var html = oEditor.EditorDocument.body.innerText;
    alert(html);
    } ; // Register the related command
    FCKCommands.RegisterCommand('Format168', new FCKFormat168('Format168'));
    测试可以
      

  11.   

    非常非常感谢上面这位朋友  
    不过那个链接的方法好像有点复杂  我后来直接在 FCKConfig.ToolbarSets["Default"] = 里加了一个  
    然后在相应的fckeditorcode_ie.js里修改  按钮是出来了 
    但在这个按钮点击事件里,我就需要获取和写入内容 的办法 。。
      

  12.   

    fckeditorcode_ie.js 好像没有 NAME值的  全是这些代码  
    FCK.RedirectNamedCommands=new Object();FCK.ExecuteNamedCommand=function(A,B){FCKUndo.SaveUndoStep();if (FCK.RedirectNamedCommands[A]!=null) FCK.ExecuteRedirectedNamedCommand(A,B);else{FCK.Focus();FCK.EditorDocument.execCommand(A,false,B);FCK.Events.FireEvent('OnSelectionChange');};FCKUndo.SaveUndoStep();};FCK.GetNamedCommandState=function(A){try{if (!FCK.EditorDocument.queryCommandEnabled(A)) return FCK_TRISTATE_DISABLED;else return FCK.EditorDocument.queryCommandState(A)?FCK_TRISTATE_ON:FCK_TRISTATE_OFF;}catch (e){return FCK_TRISTATE_OFF;};};FCK.GetNamedCommandValue=function(A){var B='';var C=FCK.GetNamedCommandState(A);if (C==FCK_TRISTATE_DISABLED) return null;try{B=this.EditorDocument.queryCommandValue(A);}catch(e) {};return B?B:'';};FCK.PasteFromWord=function(){FCKDialog.OpenDialog('FCKDialog_Paste',FCKLang.PasteFromWord,'dialog/fck_paste.html',400,330,'Word');};F
      

  13.   

    继续求救。。是不是我的FCK版本不同。。
      

  14.   

     FCKeditor在线编辑器在PHP中的使用
    http://blog.csdn.net/BossDarcy/archive/2011/02/26/6210067.aspx 
    自己总结的,希望对你有帮助