<iframe scrolling="no" height="100%" frameborder="no" width="100%" src="/sysadm/webeditor/editor/fckeditor.html?InstanceName=CONTENT&Toolbar=Default" id="CONTENT___Frame"></iframe> 新建的PHP文件,其中:
<script type="text/javascript" src="../js/fck_startup.js"></script>
<script type="text/javascript" src="common/fck_dialog_common.js"></script>
<script>function insertpic(url){
var oEditor = FCKeditorAPI.GetInstance('CONTENT');
alert(oEditor);
oEditor.InsertHtml(url);
}
</script>输出的oEditor为 undefined ,实在搞不懂错在哪了,在另一个JS里用var oEditor = FCKeditorAPI.GetInstance('CONTENT');是可以的,难不成PHP文件就不行??

解决方案 »

  1.   

    使用 FCKeditorAPI.GetInstance 的条件是什么? 已经试过很多JS调用了
      

  2.   

    下面只是纯属个人猜测……iframe方式,父框架获取fckeditor对象,是否需要指定window.frameName……???
      

  3.   

    var SetFCK = FCKeditor_OnComplete;  //重写事件
        $(document).ready(function(){
            SetFCK;
        });function FCKeditor_OnComplete(editorInstance)
        {var oEditor = FCKeditorAPI.GetInstance('CONTENT');
        alert(oEditor);}
      

  4.   

    FCKeditor_OnComplete;  //重写事件这个名称要跟API相同才行。
      

  5.   

    你到底是用的是什么版本的 FCKeditor ?
    他公司用 CKeditor 替换 FCKeditor 也已经好几年了
      

  6.   

    直接 var SetFCK = FCKeditor_OnComplete; 这样写吗,不是函数来的么,不是很明白,我照搬过去不行耶
      

  7.   


    FCKeditorAPI.Version='2.1.1'; 只有这句,是版本吗。 估计很旧的了。
    上面没要求换,换的话要改很多东西吧,之前也增加过一些功能
      

  8.   

    //这一方法放在前面
    function FCKeditor_OnComplete(editorInstance)
    {}
      

  9.   


    function FCKeditor_OnComplete(editorInstance){
        alert("c");
        var oEditor = FCKeditorAPI.GetInstance('CONTENT');
        alert("d");
        alert(oEditor);
    }
    var SetFCK = FCKeditor_OnComplete;  //重写事件
        $(document).ready(function(){
        alert("a");
        SetFCK;
        alert("b");
        });我弄成这样了,alert(oEditor);一样不行。但好像输出过一次 C 和 D ,后来就都是只有A 和B了 。