Internet explorer says Object does not support this property or method

This line: 79:

window.addEvent('domready', function(){     
    mySlide = new Fx.Slide('advert');
    mySlide.hide();
});

      

He also dislikes this line:

this.wrapper = new Element('div',
                           {
                              'styles': $extend(
                                                this.element.getStyles('margin'), 
                                                {'overflow': ''}
                                               )
                           })
                .injectAfter(this.element)
                .adopt(this.element);

      

Does anyone know why this is happening? Does anyone know how to fix this? I am using jQuery and Mootools .. and wanted to find a solution.

+2


source to share


8 answers


If you land on this page and are desperately looking for why you have this error in IE, let me point out another way this could happen. Hopefully either the simple act I posted will help me remember this, or this question will appear on google the next time I run into this error. It seems to happen at least once every two years.

This can show up if you named the variable (not sure if it should be global, mine was this time) the same as the element id. For example:



<div id="foo">
</div>
<script type="text/javascript">
    var foo = 1; < --Object doesn 't support this property or method!!
</script>

      

+36


source


Do you have jQuery / mooTools included before that particular line in the file? It looks to me like you included a plugin or other javascript before including the framework it relies on. I am assuming you are also using jQuery in noConflict () mode since you are using jQuery and mooTools.



+3


source


+1 for an earlier answer about variable names. This is in IE8:

title = button.attr('title'); <-- Object doesnt support this method

$title = button.attr('title'); <-- OK!

      

+3


source


This error usually occurs with IE if you are trying to assign an invalid value to the style property. If you are using IE8 and you have enabled javascript debugging under tools-> options-> advanced, then you can try to debug it and see what property assignment throws this error, then try to fix it.

0


source


This can also happen if you don't have a comma in your variable list, like the "f" variable below:

var a = 'aaaa',
    f = 'ffff'
    b = someObject.attribute;

      

0


source


A simple addition to the conversation.

In some cases (video.js / bigvideo.js comes to mind) you need to run modernizr.js as your first script before jQuery or jQuery UI. Cleans everything right.

0


source


(MooTools)

My code was something like this:

var cancel; 
//... bla bla
cancel = form.elements[i]; //cancel is now a <button>; no Id, unique on the page
cancel.addEvent('click', function(e) {...});

      

And I was getting OP's exception on cancel.AddEvent()

. For me it was rewritten as $(cancel).addEvent()

.

What a terrible browser.

0


source


it looks like you are not using jQuery. I don't say mooTools, so I can't get it completely right, but I would try something like this:

jQuery(document).ready( function() {
    //you could convert this to jQuery too, of course
    mySlide = new Fx.Slide('advert');
    mySlide.hide(); 
} );

jQuery(this).wrap( '<div class="overflow-wrapper"></div>' )
            .parent('.overflow-wrapper').css('overflow', '' );

      

-1


source







All Articles