Javascript object as an argument equals undefined in IE6-8
Have a question... I have a code that work everywher开发者_开发百科e but in IE6-8. In the beginning I define the object changeableElements (elements properties of which will be changed). Then I pass this object to function called changeCSS() as an argument. So, in IEs that object becomes equal undefined... How can I solve this problem?
Thank you very much.
http://spezlib.p-design.org - The site http://spezlib.p-design.org/resources/javascript/other.js - The script itself
You have a call to changeCSS
that has no arguments:
changeCSS();
getPreviousContrast();
changeContrast();
Change that first line to changeCSS(..., changeableElements)
with ...
replaced by whatever it is that should be there. Honestly I'm surprised it works in any browsers.
UPDATE: in for in loops IE doesn't recognize left identifier if it's not preceeded by 'var' keyword... (i.e. for (item in elements)
is wrong, should be for (var item in elements)
.
精彩评论