Re: On the client side, how to obtain plain text (like serverside's editor.PlainText) that DOES include whitespace entered by the user

  •  12-23-2009, 4:58 AM

    Re: On the client side, how to obtain plain text (like serverside's editor.PlainText) that DOES include whitespace entered by the user

    Hi robertandrews,
     
    Try this way
     
    1. <%@ Page Language="C#" %>   
    2.   
    3. <%@ Register Assembly="CuteEditor" Namespace="CuteEditor" TagPrefix="CE" %>   
    4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">   
    5. <html xmlns="http://www.w3.org/1999/xhtml">   
    6. <head runat="server">   
    7.     <title>GetPlainText</title>   
    8. </head>   
    9. <body>   
    10.     <form id="form1" runat="server">   
    11.         <CE:Editor ID="editor1" runat="server">   
    12.         </CE:Editor>   
    13.         <input type="button" value="GetPlainText" onclick="GetPlainText()" />   
    14.         <div id="plainText" style="visibility: hidden">   
    15.         </div>   
    16.     </form>   
    17. </body>   
    18. </html>   
    19.   
    20. <script>   
    21. function GetPlainText()   
    22. {   
    23.     var editor1=document.getElementById('<%= editor1.ClientID %>');   
    24.     var plainText=document.getElementById("plainText");   
    25.     plainText.innerHTML=editor1.GetHTML();   
    26.     alert(plainText.innerText);   
    27.     plainText.innerHTML="";   
    28. }   
    29. </script>  
    Regards,
     
    ken
View Complete Thread