Re: onblur event for cute editor

  •  03-23-2012, 10:38 AM

    Re: onblur event for cute editor

    Hi Rameshdurai,
     
    Please try the example below, it shows you how to catch the focus/blur function of editor.
     
    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>example</title>  
    8. </head>  
    9. <body>  
    10.     <form id="form1" runat="server">  
    11.        <input type="text" id="text1" />  
    12.        <p>Please note that textbox text changes when the focus change </p>  
    13.         <CE:Editor ID="editor1" runat="server">  
    14.         </CE:Editor>  
    15.           
    16.     </form>  
    17. </body>  
    18. </html>  
    19.   
    20. <script>  
    21. var text1=document.getElementById("text1");  
    22. function CuteEditor_OnInitialized(editor)  
    23. {  
    24.     var editdoc = editor.GetDocument();  
    25.     //for ie  
    26.     if(document.attachEvent)  
    27.     {  
    28.       
    29.         editdoc.onfocusin=function()  
    30.         {  
    31.             text1.value="focus in";  
    32.         }  
    33.         editdoc.onfocusout=function()  
    34.         {  
    35.             text1.value="focus out";  
    36.         }  
    37.     }  
    38.     //for firefox, chrome  
    39.     else  
    40.     {  
    41.         editdoc.body.addEventListener("focus",focusIn,false);  
    42.         editdoc.body.addEventListener("blur",focusOut,false);  
    43.     }  
    44. }  
    45. function focusIn()  
    46. {  
    47.     text1.value="firefox in";  
    48. }  
    49. function focusOut()  
    50. {  
    51.     text1.value="firefox out";  
    52.  }  
    53. </script>  
    Regards,
     
    Ken 
View Complete Thread