原创 元素hover 不同浏览器图片透明度处理
<SCRIPT type="text/javascript">
<!--
function changealpha(obj,n)
{
var obj;
var n;
if (n==0)
{
obj.style.filter="alpha(opacity=100)";//forIE
obj.style.opacity="1";//forFF
}
else
{
obj.style.filter="alpha(opacity=20)";//forIE
obj.style.opacity="0.2";//forFF
}
}
</SCRIPT>
<style type=text/css>
.imgtest1{
filter:alpha(opacity=20);
opacity:0.2;
}
.imgtest{
filter:alpha(opacity=20);
opacity:0.2;
}
.imgtest:hover{
filter:alpha(opacity=100);
opacity:1;
}
</style>
<img src="1.jpg" class="imgtest1" onMouseOver="changealpha(this,0)" onMouseOut="changealpha(this,1)"><br><!--同时IE FF Google-->
<img src="1.jpg" class="imgtest"><!--只适用于FF Google-->
<!--
function changealpha(obj,n)
{
var obj;
var n;
if (n==0)
{
obj.style.filter="alpha(opacity=100)";//forIE
obj.style.opacity="1";//forFF
}
else
{
obj.style.filter="alpha(opacity=20)";//forIE
obj.style.opacity="0.2";//forFF
}
}
</SCRIPT>
<style type=text/css>
.imgtest1{
filter:alpha(opacity=20);
opacity:0.2;
}
.imgtest{
filter:alpha(opacity=20);
opacity:0.2;
}
.imgtest:hover{
filter:alpha(opacity=100);
opacity:1;
}
</style>
<img src="1.jpg" class="imgtest1" onMouseOver="changealpha(this,0)" onMouseOut="changealpha(this,1)"><br><!--同时IE FF Google-->
<img src="1.jpg" class="imgtest"><!--只适用于FF Google-->
浙公网安备 33010602011771号