khaleel
khaleel

Reputation:

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.

Upvotes: 2

Views: 26928

Answers (8)

fimbulvetr
fimbulvetr

Reputation: 742

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>

Upvotes: 36

async
async

Reputation: 1537

(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 the OP's exception on cancel.AddEvent(). What fixed it for me was rewriting that as $(cancel).addEvent().

What a horrible browser.

Upvotes: 0

Imperative
Imperative

Reputation: 662

Just a quick addition to the conversation.

In some cases (video.js / bigvideo.js come to mind) you need to run modernizr.js as your first script before jQuery or jQuery UI. Clears things right up.

Upvotes: 0

kvnn
kvnn

Reputation: 350

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

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

Upvotes: 0

Dave
Dave

Reputation: 386

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

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

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

Upvotes: 3

Arun P Johny
Arun P Johny

Reputation: 388406

This error normally comes with IE if you try to assign a invalid value for a style property. If you are using IE8 and you have enabled enable javascript debugging under tools->options->advanced, then you can try to debug it and see which property assignment is throwing this error and then try to rectify this.

Upvotes: 0

austinfromboston
austinfromboston

Reputation: 3780

seems like you aren't really taking advantage of jQuery. I don't speak mooTools, so I may not get this 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', '' );

Upvotes: -1

tvanfosson
tvanfosson

Reputation: 532595

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.

Upvotes: 3

Related Questions