开发者

How to get opacity value as an int for alpha filter?

开发者 https://www.devze.com 2023-02-13 12:51 出处:网络
For Internet Explorer opacity is set in inline css like this: style=\"filter: alpha(opacity=50);\" What I\'d like to do is get the opacity value 开发者_StackOverflow社区as in integer in javascript.

For Internet Explorer opacity is set in inline css like this:

style="filter: alpha(opacity=50);"

What I'd like to do is get the opacity value 开发者_StackOverflow社区as in integer in javascript. Ok I guess I can get the whole string and parse out the int, but is there a faster/better way?

Thanks


The JavaScript is pretty simple:

var opacity = this.filters.alpha.opacity;

or if you have an id...

var opacity = getElementById('myelement').filters.alpha.opacity;
0

精彩评论

暂无评论...
验证码 换一张
取 消