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.
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>
source to share
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.
source to share
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.
source to share
(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.
source to share
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', '' );
source to share