Function like onchange in TextArea

Last post 09-01-2010, 5:03 AM by Kenneth. 1 replies.
Sort Posts: Previous Next
  •  09-01-2010, 2:09 AM 63778

    Function like onchange in TextArea

    I use CuteEditor to instead of the TextArea
     
    I have a javascript function: set_updated() when the textarea content change
    <textarea name=background class="programme" onchange="set_updated()">
     
    How to set the CuteEditor as same function.
     
    I use Cute Editor for .NET, but the coding format just like ASP only.

    I know that if using .NET, I can add the function in OnTextChange Function. But because of the ASP coding, I don't know how to do.
  •  09-01-2010, 5:03 AM 63783 in reply to 63778

    Re: Function like onchange in TextArea

    Hi surrounding,
     
    Please try the example below
     
    1. <%@ Page Language="C#" %>   
    2.   
    3. <%@ Register Namespace="CuteEditor" Assembly="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.   
    6. <script runat="server">   
    7.     protected override void OnLoad(EventArgs e)   
    8.     {   
    9.         editor1.Text = "change something here..";   
    10.         base.OnLoad(e);   
    11.     }   
    12. </script>   
    13.   
    14. <html xmlns="http://www.w3.org/1999/xhtml">   
    15. <head id="Head1" runat="server">   
    16.     <title>Untitled Page</title>   
    17. </head>   
    18. <body>   
    19.     <form id="form1" runat="server">   
    20.         <div>   
    21.             <CE:Editor ID="editor1" runat="server">   
    22.             </CE:Editor>   
    23.             <input type="button" value="check is dirty" onclick="checkIsDirty()" />   
    24.         </div>   
    25.     </form>   
    26. </body>   
    27. </html>   
    28.   
    29. <script>   
    30. var editor1=document.getElementById("<%= editor1.ClientID %>");   
    31. function checkIsDirty()   
    32. {   
    33.     if(editor1.IsDirty())   
    34.     {   
    35.         //set_updated()   
    36.         alert("is dirty");   
    37.     }   
    38. }   
    39. function CuteEditor_OnChange(editor)   
    40. {    
    41.   checkIsDirty();   
    42. }   
    43. </script>  
    Regards,
     
    ken
View as RSS news feed in XML