Javascript 无法以zend格式创建fckeditor

Javascript 无法以zend格式创建fckeditor,javascript,php,zend-framework,ckeditor,Javascript,Php,Zend Framework,Ckeditor,我想将fckeditor与我下载的表单集成在一起 一切都很好,但有以下错误 参考错误: 引用错误:未定义CKeditor 下面是js代码 <script src="<?php echo $this->baseUrl(); ?>/js/fckeditor/fckeditor.js" type="text/javascript"></script> <script type="text/javascript"> fu

我想将fckeditor与我下载的表单集成在一起

一切都很好,但有以下错误

参考错误:

引用错误:未定义CKeditor

下面是js代码

   <script src="<?php echo $this->baseUrl(); ?>/js/fckeditor/fckeditor.js" type="text/javascript"></script>
    <script type="text/javascript">
        function setUpFCK() {

            if (document.getElementById('body')) {
                var oFCKeditor = new CKeditor('body');
                oFCKeditor.BasePath = "http://localhost/ZendTecAdmin/js/fckeditor/";
                oFCKeditor.Height = 400;
                oFCKeditor.ReplaceTextarea();                    
            }
        }

    </script>
</head>

<body onload="setUpFCK()">

1-尝试检查JS文件是否在“public/JS”中,并且可以访问它,在这种情况下:
localhost/js/fckeditor/fckeditor.js

2-可以使用ZF2视图帮助器附加脚本文件

<?php echo $this->headScript()
  // you can also use appendFile if the library has dependencies, that needed to be loaded first.
 ->prependFile($this->basePath() . '/js/fckeditor/fckeditor.js');
?>
2-或者使用onload函数附加onload事件处理程序

<script>
    function attachEvent(){
        window.onload = setUpFCK;
    }
</script>
<body onload="attachEvent()">

函数attachEvent(){
window.onload=setUpFCK;
}

我可以访问localhost/js/fckeditor/fckeditor.jsI已经更新了答案,问题在于onload函数,它应该在
窗口上
而不是
正文上
<script>
    function attachEvent(){
        window.onload = setUpFCK;
    }
</script>
<body onload="attachEvent()">