js获取Fckeditor中的内容值

来源:互联网 发布:中科大软件学院院长 编辑:程序博客网 时间:2024/06/06 05:49

<script type="text/javascript" language="javascript">

    function a()

    {

            //得到控件的html

             var checkContent =FCKeditorAPI.GetInstance("FCKeditor1").GetXHTML();

            alert(checkContent);

            //得到html的长度

             var len = FCKeditorAPI.GetInstance("FCKeditor1").GetXHTML().length;

            alert(len);

            //得到fck控件

            var oEditor = FCKeditorAPI.GetInstance('FCKeditor1');

            //得到编辑器中的文字

            var text = oEditor.EditorDocument.body.innerText;

            alert(text);

            //让编辑器得到焦点

            oEditor.Focus();

 

    }

    </script>