参考下:http://winsky2000.spaces.live.com/Blog/cns!B9C10CA6C0602231!310.entry

解决方案 »

  1.   

    FCKeditor不好统计吧, 他会自动加入一些HTML标记~ 
      

  2.   

    <script type="text/javascript" src="fckeditor.js"></script>
    <script type="text/javascript"> 
    function FCKeditor_OnComplete( editorInstance ) 

    //editorInstance.EditorDocument.attachEvent("onkeydown", editor_keydown); 
    editorInstance.EditorDocument.attachEvent("onkeyup", editor_keyup); 

    function editor_keyup() 

    var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ;  
        var keycode = oEditor.EditorWindow.event.keyCode; 
       var text=oEditor.GetXHTML(true); 
    document.getElementById("num").innerHTML=text.length;
        if(text.length>1000){ 
    alert("你输入的字符过多!!"); 
    return false; 
    } } 
    </script>  </head>
    <body>

    <form action="post.asp" method="post" target="_blank">
    <script type="text/javascript">
    var sBasePath = document.location.pathname.substring(0,document.location.pathname.lastIndexOf('_samples')) ;var oFCKeditor = new FCKeditor( 'FCKeditor1' ) ;
    oFCKeditor.BasePath = sBasePath ;
    oFCKeditor.Value = 'fsdf.' ;
    oFCKeditor.Create() ;
    //-->
    </script>
    <br>
    <input type="submit" value="Submit">
    </form>已输入字符:<span id="num"> <span> 
    </body>
    </html>这个是我测试成功的,IE6下不知道其他兼容没
      

  3.   

    测试了下,FF3.0  editorInstance.EditorDocument.attachEvent("onkeyup", editor_keyup); 
    这个出错了
      

  4.   

    只是不兼容FF3.0代码不兼容FF3.0
      

  5.   

    刚刚测试了,不兼容FF3.0,google等标注浏览器