Set opacity with javascript in IE 8?

2019-05-25 09:19发布

问题:

How can I get this "opacity-fallback" to work in IE 8?

I only want to use pure Javascript, no CSS or jQuery.

http://jsfiddle.net/snabbdesign/LeLfB/11/

回答1:

 e.filter = "alpha(opacity:" + value * 100 + ")";

needs to be

e.style.filter = 'alpha(opacity=' + value*100 + ')'; 

notice style and the =