Plain Text Word Count

Last post 10-18-2005, 1:57 PM by Adam. 1 replies.
Sort Posts: Previous Next
  •  10-18-2005, 12:23 AM 11786

    Plain Text Word Count

        Hi,

        Is there a way to get the word count , which will shows me the same number of Words as the NetSpell is going to give us. Because there are discrepancies in the actual result and the result given by the Spell Checker(NetSpell).

    And also I want the word count to be at the client side.


    Regards

    Vikas Joshi

    Vikas Joshi
  •  10-18-2005, 1:57 PM 11812 in reply to 11786

    Re: Plain Text Word Count

    Vikas, 
     
    Please try the following code:
     
        // get the cute editor instance
        var editor1 = document.getElementById('CE_Editor1_ID');
        
        //Get the editor content 
        var editdoc=editor1.GetDocument();
        // attach Event
        if(editdoc.attachEvent)
         editdoc.attachEvent('onkeypress',HandleChange);
        else if(editdoc.addEventListener)
         editdoc.addEventListener('keypress',CountWords,true);
       }   
         
       function CountWords()
       {
        // get the cute editor instance
        var editor1 = document.getElementById('CE_Editor1_ID');
        var div=document.createElement("DIV");
         div.innerHTML=editor1.getHTML();
         alert(div.innerText.length);
       }
     
    Hope it helps.
     
    let me know if you have any further questions.
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

View as RSS news feed in XML