onfocus in IE doesnt work but does in FF

Last post 07-16-2010, 11:43 AM by mreric. 1 replies.
Sort Posts: Previous Next
  •  07-15-2010, 5:27 PM 62523

    onfocus in IE doesnt work but does in FF

    Hi guys,
     
    Has anyone gotten the onfocus event to work in IE.  Works fine in FF but not IE.  Followed the examples and tried different casing, but still no go.  Code is below.
     
    FF is using the event listener whilst IE is just attaching the event.  I have a feeling that there is another default  onfocus event that is overwriting the attached event.
     
                //Get the editor content  
                var editdoc=activityEditor.GetDocument();
                
                // attach Event
                if(editdoc.attachEvent){
                    editdoc.attachEvent('onfocus',activity_onFocus);
                    editdoc.attachEvent('onblur',activity_onBlur);}
                else if(editdoc.addEventListener){
                    editdoc.addEventListener('focus',activity_onFocus,true);    
                    editdoc.addEventListener('blur',activity_onBlur,true);}
     
     
    Thanks!
     
    Eric
  •  07-16-2010, 11:43 AM 62538 in reply to 62523

    Re: onfocus in IE doesnt work but does in FF

    Hi Guys,
     
    Support pointed me to a new peice of code.  It should be:

                //Get the editor content  
                var editdoc=activityEditor.GetDocument();
                
                // attach Event
                if(editdoc.attachEvent){
                     editdoc.body.attachEvent('onfocus',activity_onFocus);
                     editdoc.body.attachEvent('onblur',activity_onBlur);
                else if(editdoc.addEventListener){
                    editdoc.addEventListener('focus',activity_onFocus,true);    
                    editdoc.addEventListener('blur',activity_onBlur,true);}
     
    Can this be changed in the documentation please?
     
    Thanks!
View as RSS news feed in XML