js / jquery 获取和设置 FCK Editor 的值


  开发中遇到 通过 $("#content").val(); 或者 document.getElementById("content"); 并不能获取到 id 为 content的值

   $("#content").val(--赋值的信息--); 也不能为 id 为 content 赋值;

  页面代码:

      <tr>
               <td class="p12">内容:td>
               <td colspan="3">
                 <fck:editor id="content" basePath="${ctx}/scripts/fckeditor/" skinPath="skins/office2003/">                                                 
           fck:editor> td> tr>

  js 获取值的方法:

        var oEditor = FCKeditorAPI.GetInstance('content');//content为fck实例的id
        var content = oEditor.GetXHTML(true);

  赋值的代码:

        var oEditor = FCKeditorAPI.GetInstance("content") ;  
        oEditor.SetHTML(--赋予的值--) ;  

           就这么愉快的解决了~