我在文本框(content)中添加了内容,我alert(content);出的东西依然是空的,也就是我用普通的方式拿不到文本编辑器(fck:editor)中的内容。
如下的编辑器 内容:<fck:editor id="content" basePath="${pageContext.request.contextPath}/fckeditor/"
            customConfigurationsPath="${pageContext.request.contextPath}/fckeditor/myconfig.js"
            toolbarSet="Customer" width="100%" height="400">
       </fck:editor>我用通常的方式(javascript函数)(如下)获取不到值:
var content = document.getElementById("content");
alert(content.value);
if (content.value == '') 
{
    alert("添加公告内容不能为空,请添加!");
    content.focus();
}else{
    document.form1.submit();
}

解决方案 »

  1.   

    var fCKeditorContent = FCKeditorAPI.GetInstance("FCKeditor1").GetXHTML();//FCKeditor1是FCkeditor的ID
    这样试试 。
      

  2.   

    this.getValue = function(){
    var ret = document.getElementById("content").innerHTML;
      if(typeof(FCKeditorAPI) !== 'undefined'){
      oEditor = FCKeditorAPI.GetInstance("content");
      }
      try{
    ret = oEditor.GetXHTML(true)
    }catch(e){
    return "";
    }
    return ret;
      }
    这样试试
      

  3.   

     FCKeditorAPI他怎么来的呢?
      

  4.   

    FCKeditorAPI为甚么报出未定义的错误
      

  5.   

    在FCK组件下面,里面有个js,fckeditorcode_ie.js 搜下就知道了