Re: Add a Event to Textarea in CE

  •  02-02-2006, 1:30 AM

    Re: Add a Event to Textarea in CE

    My Source Code :
     -----------------------------------------------------------------------------------------------------
    <%@ Page Language="C#"%>
    <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>
    <html>
        <head>
      <meta name="ProgId" content="SharePoint.WebPartPage.Document">
      <meta name="WebPartPageExpansion" content="full">
      <title>ASP and ASP.NET WYSIWYG Editor - Default Configuration </title>
      <link rel="stylesheet" href="../example.css" type="text/css" />
     </head>
     <body>
            <form runat="server">
       
       <table border="0" cellpadding="0" cellspacing="0">
        <tr>
         <td width=10 nowrap></td>
         <td valign="top" nowrap id="leftcolumn" width="160">
            
         </td>
         <td width="20" nowrap></td>
         <td valign="top" width="760">
          <b>Enable All Toolbars</b>
          <hr>
          This example show you <b>all the predefined buttons</b>.
          <br>
    <INPUT id="blang" class="btchzaban" onclick="chzaban()" type="button" value="FA" name="blang" title=" CTRL + L " ><br>
         
     <CE:Editor id="Editor1" EditorWysiwygModeCss="../example.css" runat="server" ></CE:Editor><br />
          </td>
        </table>   
      </form>
     <script language="JavaScript" type="text/javascript" >
           
            // JavaScript source code
    //-----------------------------

    function keyConv(e)
    {
     
     
     alert(e.keyCode)
     
    }
    //------------------------------
    function chzaban()
    {
     CE_attachEvent();
     
    }
      
    //------------------------------------------------------------------
    function CE_attachEvent()
       {
        // get the cute editor instance
        var editor1 = document.getElementById('CE_Editor1_ID');
       
        //Get the editor content 
        var editdoc=editor1.GetDocument();
        // attach Event
        if(editdoc.attachEvent)
       
      editdoc.attachEvent('onkeypress', keyConv(event));
       
        else if(editdoc.addEventListener)
         editdoc.addEventListener('keypress', keyConv(event),true);
       }  
      
    //-----------------------------------------------------------------

          
            </script>

     </body>
    </html>
    ------------------------------------------------------------------------------------
     
     I have a request : at first User Click On "FA Button", then  user must be click on  textarea and type anythings , now I want To Create an  Alert Box about KeyCode .
View Complete Thread