这是我到目前为止所做的:
<img src="images/test.jpg"
class="black"
onmouseout="this.style.opacity=1;
this.filters.alpha.opacity=100;
this.style.filter='progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"
onmouseover="this.style.opacity=0.3;
this.filters.alpha.opacity=30;
this.style.filter='progid:DXImageTransform.Microsoft.Alpha(Opacity=30)'"
/>
它适用于FF和Safari,但不适用于IE 7或8 建议?
答案 0 :(得分:2)
唉!获胜的CSS!
<style>
img.black:hover {opacity: 0.3; filter:alpha(opacity=30);}
</style>
答案 1 :(得分:2)
丢失this.filters.alpha.opacity=30
行。更正后的代码:
<img src="images/test.jpg" class="black"
onmouseout="this.style.opacity=1;
this.style.filter='progid:DXImageTransform.Microsoft.Alpha(Opacity=100)'"
onmouseover="this.style.opacity=0.3
this.style.filter='progid:DXImageTransform.Microsoft.Alpha(Opacity=30)'"
/>
答案 2 :(得分:0)
你是否考虑使用像YUI或JQuery这样的框架来帮助你规范化这样的跨浏览器不一致?