Spencer Carnage
Spencer Carnage

Reputation: 2066

Invalid argument. IE 7-8

I'm using the MooTools library and I'm seeing the error of "Invalid Argument" on the .setStyle() method for IE 7 and 8. The line of code that's throwing the error is the following:

this.style[property] = value; 

I understand this is something I need to take up with the MooTools community, but I was curious as to why IE would throw this error. The this is referring to an HTMLDivElement, BTW.

Upvotes: 0

Views: 753

Answers (1)

Mike L.
Mike L.

Reputation: 1966

I have ran across this problem LOADS of times, all you need to do is typecast your value for width as an integer before you assign it, you are using mootools so do this

this.style[property] = value.toInt();

Thats using what you have your better off actually using mootools (especially for opacity and stuff since it will actually handle IE as well, and using this:

this.setStyle('property', value.toInt());

I am sure you are preforming some calculations, then supplying IE with a double value for pixel, and older versions of IE will not take a decimal number as a pixel.

Upvotes: 1

Related Questions