在WEB前端工程师的道路上,有一个美好的梦。。。。

一个女生在IT职业道路上的成长经历

 

原创 元素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-->

posted on 2008-09-24 16:03  坏坏兔  阅读(238)  评论(0)    收藏  举报

导航