views:

244

answers:

3

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?

A: 

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

vicatcu
+1  A: 

Ugh! CSS for the win!

<style>
img.black:hover {opacity: 0.3; filter:alpha(opacity=30);}
</style>
SpliFF
Just remember that `:hover` will only work on `<a>` elements in IE6.
Andy E
+1  A: 

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