...

View Full Version : .style works in FF but not IE



jcdevelopment
06-18-2008, 03:11 PM
This piece of code works in FF


firstSelectedDiv.style.opacity = '0.5';


How come it wont work in IE7?

I have tried looking it up but i cant find any answers or help, probably because im not typing it in correctly.

Thanks for any help.

jcdevelopment
06-18-2008, 04:07 PM
I was able to find this also. It doesnt work for IE, it just sends an error



secondSelectedDiv.style.filter = 'alpha(opacity='50')';


Still cant seem to find out whats wrong

abduraooft
06-18-2008, 05:24 PM
Firefox uses MozOpacity , see http://www.javascriptkit.com/dhtmltutors/opacityns6.shtml

abduraooft
06-18-2008, 05:25 PM
I was able to find this also. It doesnt work for IE, it just sends an error



secondSelectedDiv.style.filter = 'alpha(opacity='50')';


Still cant seem to find out whats wrong

May be an issue with escaping quotes, try

secondSelectedDiv.style.filter ="alpha(opacity='50')";

jcdevelopment
06-18-2008, 05:37 PM
That worked, it took me while to figure out the alternative JS for FF but i got it, thanks for letting me know anyways.

rnd me
06-18-2008, 05:45 PM
Firefox uses MozOpacity , see http://www.javascriptkit.com/dhtmltutors/opacityns6.shtml

Want to quickly point out that firefox uses the regular "opacity: 0.5" as well. Use MozOpacity only when you don't want transparency in safari and opera.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum