reading image opacity

D

Dean Edwards

I am attempting to change the opacity of an image. I can modify opacity ok:

function flip(pic, opacity){
pic.style.filter = 'alpha(opacity='+opacity+')';
}


But I'm not familiar with javascript. How can I read the existing opacity
value?

accessing the value like:

opacity=cell.style.filter.alpha.opacity;

does not work (in IE6).


Also I am having trouble with the equivalent netscape syntax.

Any help would be much appreciated.

TIA
 
V

Vjekoslav Begovic

Dean Edwards said:
I am attempting to change the opacity of an image. I can modify opacity ok:

function flip(pic, opacity){
pic.style.filter = 'alpha(opacity='+opacity+')';
}


But I'm not familiar with javascript. How can I read the existing opacity
value?

accessing the value like:

opacity=cell.style.filter.alpha.opacity;

does not work (in IE6).

If you have:

<img id=sample src=sample.jpg style="filter:
progid:DXImageTransform.Microsoft.Alpha(opacity=50)">

than you could do:

sample.filters.item("DXImageTransform.Microsoft.Alpha").opacity += 10;

http://msdn.microsoft.com/library/d...hop/author/filter/reference/filters/alpha.asp

Also I am having trouble with the equivalent netscape syntax.

Filters are IE specific.

HTH

Vjekoslav
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top