<style>
.blendTrans{filter:alpha(opacity=100) blendTrans(duration=1)}
</style>
<script>
function over(){
with(event.srcElement.filters){
blendTrans.apply();
alpha.opacity=50;
blendTrans.play();
}
}
function out(){
with(event.srcElement.filters){
blendTrans.apply();
alpha.opacity=100;
blendTrans.play();
}
}
</script>
<img src=" http://www.google.cn/images/nav_logo3.png" class="blendTrans" onmouseover="over()" onmouseout="out()" >
.blendTrans{filter:alpha(opacity=100) blendTrans(duration=1)}
</style>
<script>
function over(){
with(event.srcElement.filters){
blendTrans.apply();
alpha.opacity=50;
blendTrans.play();
}
}
function out(){
with(event.srcElement.filters){
blendTrans.apply();
alpha.opacity=100;
blendTrans.play();
}
}
</script>
<img src=" http://www.google.cn/images/nav_logo3.png" class="blendTrans" onmouseover="over()" onmouseout="out()" >
本文介绍了一种使用HTML和JavaScript实现图片透明度变化的方法。通过定义CSS样式和JavaScript函数,当鼠标悬停在图片上时,图片会逐渐变为半透明;而当鼠标移开时,图片又恢复为完全不透明的状态。这种方法可以应用于网页设计中,增加用户交互体验。

被折叠的 条评论
为什么被折叠?



