If I have this HTML
<img src="aaa.png" id="a" style="filter: alpha(opacity=100)"/>
Then this javascript works in IE6
document.getElementById("a").filters.alpha.opacity = 60;
But if no style is set
<img src="aaa.png" id="a" style=""/>
The javascript throws an error 'filters.alpha' is null or not an object
This code works
document.getElementById("a").style.filter = "alpha(opacity=60)";
But then the other filters applied to the image are overwritten. So the question is: How to add alpha filter to any HTML element and keep the other filters in IE?
edit I would like pure javascript (not jQuery) solution
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…