Re: OnKeyup Attaching Events

  •  05-28-2008, 1:26 PM

    Re: OnKeyup Attaching Events

    I am revisiting using cute editor again, i have the corrected code as stated above. The events attach...I also have attached a keypress event. Now every onkeypress event now fires both an onmouseleave and an onkeypress event. I also cannot get an onkeyup event to fire...here is the code now:
     
     
     <script type="text/javascript">
     
       setTimeout(CE_attachEvent,1000);  
          
       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)
        {
         //editor1.attachEvent('onfocus',HandleChange);
         editor1.attachEvent('onmouseleave',HandleChange);
         editdoc.attachEvent('onkeypress',HandleChange);
         editdoc.attachEvent('onkeyup',HandleChange);

         }
         else if(editdoc.contentDocument.addEventListener)
         {
         //editor1.contentDocument.addEventListener('focus',HandleChange,true);
         editor1.contentDocument.addEventListener('mouseleave',HandleChange,true);
         editdoc.addEventListener('keypress',HandleChange,true);
         editdoc.addEventListener('keyup',HandleChange,true);
        }
       }  
     
       function HandleChange(eventFired)
       {
        alert(eventFired.type);
        }
     
      </script>

View Complete Thread