问题
I'm using Jquery in my project. Everything works good on Firefox, but on IE, I get error saying "Invalid argument","Code 0". I found that the line
$(thisObj).css({'border':'1px dotted transparent;'});
is causing problem.
Is there any other way to set the css ?
Also, in the same project, I'm using styleSheet object. I have completed the functionality and it works on Firefox. Now, While I tested on IE, I needed to change some property names to make it working. What can be the best way to make it working for IE also. Do I need to rewrite the functions for IE ?
Thanks in advance.
回答1:
i usually use $(thisObj).css('border','1px dotted transparent'); syntax
回答2:
When using a setting call to .css() you shouldn't include the trailing semi colon on the value, as you would in a normal bit of CSS.
$(thisObj).css({'border':'1px dotted transparent;'});
|
//remove this semi-colon
$(thisObj).css({'border':'1px dotted transparent'});
I've just quickly tested this on my work IE7 machine here, and adding a semi-colon to any .css() call of this nature instantly breaks it with the error message you are quoting.
来源:https://stackoverflow.com/questions/4203881/error-invalid-argument-code-0-on-ie8-in-jquery