Re: onblur event for cute editor

  •  03-26-2012, 8:00 AM

    Re: onblur event for cute editor

    Hi Rameshdurai,
     
    Method CuteEditor_OnInitialized will set it for each editor. You can separate it by editor.id.
     
    Like 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. <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.            <CE:Editor ID="editor2" runat="server">    
    16.         </CE:Editor>    
    17.     </form>    
    18. </body>    
    19. </html>    
    20.     
    21. <script>    
    22. var text1=document.getElementById("text1");    
    23. function CuteEditor_OnInitialized(editor)    
    24. {    
    25.     var editdoc = editor.GetDocument();    
    26.     //for ie    
    27.     if(document.attachEvent)    
    28.     {    
    29.         
    30.         editdoc.onfocusin=function()    
    31.         {    
    32.             text1.value="focus in";    
    33.         }    
    34.         editdoc.onfocusout=function()    
    35.         {    
    36.             text1.value="focus out";    
    37.         }    
    38.     }    
    39.     //for firefox, chrome    
    40.     else    
    41.     {    
    42.         editdoc.body.addEventListener("focus",focusIn,false);    
    43.         editdoc.body.addEventListener("blur",focusOut,false);    
    44.     }    
    45. }    
    46. function focusIn()    
    47. {    
    48.     text1.value="firefox in";    
    49. }    
    50. function focusOut()    
    51. {    
    52.     text1.value="firefox out";    
    53.  }    
    54. </script>    
     
    Regards,
     
    Ken 
View Complete Thread