admin管理员组

文章数量:1418103

This is what I have so far:

<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)'" 
/>

It's works in FF and Safari, but not IE 7 or 8.
Suggestions?

This is what I have so far:

<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)'" 
/>

It's works in FF and Safari, but not IE 7 or 8.
Suggestions?

Share Improve this question asked Jan 13, 2010 at 16:48 kylexkylex 14.4k36 gold badges117 silver badges177 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 2

Ugh! CSS for the win!

<style>
img.black:hover {opacity: 0.3; filter:alpha(opacity=30);}
</style>

Lose the this.filters.alpha.opacity=30 line. Corrected code:

<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)'"  
/> 

Have you considered using a framework like YUI or JQuery to help you normalize cross-browser inconsistencies like this?

本文标签: transparencyonmouseover javascript opacity for IE8 and IE7Stack Overflow