两个需要编辑的地方,只正常调用了一个
请问怎样修改
<script language="javascript" type="text/javascript" src="editor/fckeditor/fckeditor.js"></script>
<script type="text/javascript">
window.onload = function()
{
var oFCKeditor = new FCKeditor( 'content' ) ;
oFCKeditor.Height = "400";
oFCKeditor.Width = "100%" ; 
oFCKeditor.BasePath = '/editor/fckeditor/' ;
oFCKeditor.ReplaceTextarea() ;
}function fckAddText(txt)
{
var oEditor = FCKeditorAPI.GetInstance('content');
oEditor.InsertHtml(txt);
}window.onload = function()
{
var oFCKeditor = new FCKeditor( 'content2' ) ;
oFCKeditor.Height = "400";
oFCKeditor.Width = "100%" ; 
oFCKeditor.BasePath = '/editor/fckeditor/' ;
oFCKeditor.ReplaceTextarea() ;
}function fckAddText(txt)
{
var oEditor = FCKeditorAPI.GetInstance('content2');
oEditor.InsertHtml(txt);
}
</script>

解决方案 »

  1.   

    现在用ckeditor好上不少。ckeditor更小,更快速。看你的代码,和我以前用FCKeditor时的调用完全不一样。我记得我的简单得太多,爱用几个就用几个,查一下使用手册把。
      

  2.   


    window.onload需要修改一下,因为后面的window.onload覆盖了前一个,代码修改如下:
    <script language="javascript" type="text/javascript" src="editor/fckeditor/fckeditor.js"></script>
    <script type="text/javascript">function create_fck(id)
    {
    var oFCKeditor = new FCKeditor(id) ;
    oFCKeditor.Height = "400";
    oFCKeditor.Width = "100%" ; 
    oFCKeditor.BasePath = '/editor/fckeditor/' ;
    oFCKeditor.ReplaceTextarea() ;
    }
    window.onload = function()
    {  
      create_fck('content');
      create_fck('content2');
    }function fckAddText1(txt)
    {
    var oEditor = FCKeditorAPI.GetInstance('content');
    oEditor.InsertHtml(txt);
    }function fckAddText2(txt)
    {
    var oEditor = FCKeditorAPI.GetInstance('content2');
    oEditor.InsertHtml(txt);
    }
    </script>
    函数名不能相同,否则以最后一个定义的函数为准
      

  3.   

    我推荐LZ用kindedit这个比较好用,看一下示例就明白了,祝你成功
      

  4.   

    FCK不美观,而且笨重,建议使用kindeditor看着清爽,而且使用简单。