Re: clearing the textbox on focus

  •  01-11-2011, 9:01 PM

    Re: clearing the textbox on focus

    hi lonnie,
     
    I think you are using the asp.net version of editor. So please try the example below.
     
    By the way, the asp.net version forum is http://cutesoft.net/forums/23/ShowForum.aspx
     
    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. <html xmlns="http://www.w3.org/1999/xhtml">  
    6. <head id="Head1" runat="server">  
    7.     <title>Untitled Page</title>  
    8. </head>  
    9.   
    10. <script runat="server">  
    11.     protected override void OnLoad(EventArgs e)  
    12.     {  
    13.         editor1.Text = "this is a test";  
    14.         base.OnLoad(e);  
    15.     }  
    16. </script>  
    17.   
    18. <body>  
    19.     <form id="form1" runat="server">  
    20.         <CE:Editor ID="editor1" runat="server">  
    21.         </CE:Editor>  
    22.     </form>  
    23. </body>  
    24. </html>  
    25.   
    26. <script type="text/javascript">     
    27. function CuteEditor_OnInitialized(editor)  
    28. {  
    29.     var editor1=document.getElementById("<%= editor1.ClientID %>");    
    30.     var editdoc = editor1.GetDocument();  
    31.     if(editdoc.body.addEventListener)  
    32.     {  
    33.        editdoc.addEventListener("focusin",clearContent,false);  
    34.     }  
    35.     else  
    36.     {  
    37.         editdoc.onfocusin=function()  
    38.         {  
    39.              editor1.SetHTML("");  
    40.         }  
    41.     }  
    42. }  
    43.   
    44. function clearContent()  
    45. {  
    46.     var editor1=document.getElementById("<%= editor1.ClientID %>");    
    47.     editor1.SetHTML("");  
    48. }  
    49.                
    50.           
    51. </script> 
     
     
    Regards,
     
    Ken
View Complete Thread