Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Internet explorer says Object doesn't support this property or method

This line is 79:

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

It also does not like 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 happens? Does anyone know how to fix this? I am using jQuery and Mootools.. and wanted a solution.


2 Answers

In case you are landing on this page while desperately searching for why you have this error in IE, allow me to point out another way this can happen. Hopefully, either the mere act of me posting this will help me remember this, or this question will show up in google the next time I run into this error. It seems to happen at least every 2 years.

This can show up if you've named a variable (Not sure if it has to be global, mine was this time) the same thing as an element's ID. For instance:

<div id="foo">
</div>
<script type="text/javascript">
    var foo = 1; < --Object doesn 't support this property or method!!
</script>
like image 63
fimbulvetr Avatar answered Mar 21 '26 16:03

fimbulvetr


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

like image 45
tvanfosson Avatar answered Mar 21 '26 15:03

tvanfosson