var oEditor = FCKeditorAPI.GetInstance("content");
var oDOM = oEditor.EditorDocument;
var ec = oDOM.body.innerHTML;
alert(ec);

解决方案 »

  1.   

    由于昨天全天停电,直到现在才回复抱歉。
    风之石所说的我早先已经测试过。内容是有的,内容也可以插入,但是插入点有问题,总是在内容的开始。
    例如:abcdef我要在f后或者在c后插入<img src="..." />一段内容,但是不可以,插入的内容会在a前面。我试着找了一下原因,发现,如果我在上传的同时,如果能把光标移动到我想要的位置上,那么就可以达到预期的效果,如果,我没有去做上述一步,那么插入的内容就会在所有内容之前。
      

  2.   

    如果要插入到光标所在位置,只能用selection.createRange()来试试了!
      

  3.   

    selection试过,可以看我顶楼代码有没有不对的地方,清指出具体方案。
      

  4.   

    飘过。。好久不见hanpoyangtitan(韩波洋)同学
      

  5.   

    我发现在编辑器所在的页面可以正常操作,但是在一个iframe中却不能
      

  6.   

    iframe中不能,是不是因为获取不到你所想插入的位置,因为鼠标焦点在另个iFrame或者页面中,所以失败。
      

  7.   

    live2k说的和我想得一样,但是之前我将焦点落回到编辑器中,如楼顶代码1,3
    1)var oEditor=parent.FCKeditorAPI.getInstance("content");
       var win=oEditor.EditorWindow;
       win.focus();
       var doc=oEditor.EditorDoument;
       var rng=doc.selection.createRange();
       rng.pasteHTML(myHtml);
    win.focus();这句是起作用的,没有这句插入不了任何内容,但是,插入的位置不对。
      

  8.   

    我要的功能很复杂7天?,2天,1天。
    我说楼上的,你不是开玩笑吧,你一天能做出一个fckeditor?
      

  9.   

    var oEditor = parent.FCKeditorAPI.GetInstance('content')
    oEditor.InsertHtml('内容')
      

  10.   

    btbtd(转型(L/C)AMP) ( ) 信誉:100  2007-07-31 12:05:45  得分: 0  
     
     
    这有什么奇怪的...
    刚开始是0
    以后就是x集拼接...
    然后熟悉了就容易了,,,,
    你以为每次都重写呀..........
      
    -----------------------------------X问题是我不能等到n^m年后再用x的拼集
      

  11.   

    回复:mayi545() 
    这个我试过了,图片只能插入在内容得最前面,虽然可以粘贴复制到需要的位置,但是我认为很不爽,现在我用这种方法解决了:
    我将图片文件上传的提交按钮放到了FCKeditor所在的页面内,没有和表单放在同一文件中,这样就可以暂时解决上传以后焦点错误的问题。
    但是我不认为这是一种好办法,所以期待大家的答案
    另外400分依然有效。
      

  12.   

    你可以看下fck扩展
    我在phpx看到
    ------------------------------------------
    //获取格式化的编辑器内容
    function getEditorContents(){
      var oEditor = FCKeditorAPI.GetInstance("content");
      alert(oEditor.GetXHTML(true));
    }
    //就上面这个函数可以取到值,
    -------------------------------------------------------------------------
    下面的是其它操作FCK的方法,一起贴过来//向编辑器插入指定代码
    function insertHTMLToEditor(codeStr){
      var oEditor = FCKeditorAPI.GetInstance("content");
      if (oEditor.EditMode==FCK_EDITMODE_WYSIWYG){
        oEditor.InsertHtml(codeStr);
      }else{
        return false;
      }
    }
    //统计编辑器中内容的字数
    function getLength(){
      var oEditor = FCKeditorAPI.GetInstance("content");
      var oDOM = oEditor.EditorDocument;
      var iLength ;
      if(document.all){
        iLength = oDOM.body.innerText.length;
      }else{
        var r = oDOM.createRange();
        r.selectNodeContents(oDOM.body);
        iLength = r.toString().length;
      }
      alert(iLength);
    }
    //执行指定动作
    function ExecuteCommand(commandName){
      var oEditor = FCKeditorAPI.GetInstance("content") ;
      oEditor.Commands.GetCommand(commandName).Execute() ;
    }
    //设置编辑器中内容
    function SetContents(codeStr){
      var oEditor = FCKeditorAPI.GetInstance("content") ;
      oEditor.SetHTML(codeStr) ;
    }
      

  13.   

    楼主可以参考一下这里:
    http://www.xidea.org/project/jsi/test/fckeditor/_samples/html/sample08.html
      

  14.   

    dh20156(风之石) ( ) 信誉:4 
    那种情况我知道,问题现在是在iframe 中,请亲自测试
      

  15.   

    oEditor=FCKeditorAPI.GetInstance('content');
    if(oEditor.EditorWindow){
      oEditor.InsertHtml(codeStr);
    }最新版的FCK
      

  16.   

    用2.4.3版测试如下:
    在编辑器所在的页面添加一个函数
    function insertHTMLToEditor(codeStr)
    {
      oEditor=FCKeditorAPI.GetInstance('content');
      if(oEditor && oEditor.EditorWindow){
        oEditor.InsertHtml(codeStr);
      }
    }在iframe中调用parent.insertHTMLToEditor(codeStr);
      

  17.   

    请到http://community.csdn.net/Expert/topic/5678/5678132.xml?temp=.6486322拿分