Richard H
Richard H

Reputation: 39055

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

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 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

Upvotes: 0

Views: 4600

Answers (1)

Surreal Dreams
Surreal Dreams

Reputation: 26380

The JavaScript is pretty simple:

var opacity = this.filters.alpha.opacity;

or if you have an id...

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

Upvotes: 4

Related Questions