鼠标感应渐显图片

鼠标感应渐显图片
<html>
<head>
<title></title>
<script language="javascript">
var min=10;
var max=100;
var number=1;
function OnMouseOver(obj)
{
if(obj.changing)
clearInterval(obj.changing);
obj.changing=setInterval("add("+obj.id+")",10);
}
function OnMouseOut(obj)
{
if(obj.changing)
clearInterval(obj.changing);
obj.changing=setInterval("sub("+obj.id+")",10);
}
function add(obj)
{
if(obj.filters.Alpha.Opacity > max)
{
clearInterval(obj.changing);
obj.changing=false;
obj.filters.Alpha.Opacity = max;
}
else
obj.filters.Alpha.Opacity += number;
test1.innerText = "img1:"+img1.filters.Alpha.Opacity;
test2.innerText = "img2:"+img2.filters.Alpha.Opacity;
}
function sub(obj)
{
if(obj.filters.Alpha.Opacity < min)
{
clearInterval(obj.changing);
obj.changing=false;
obj.filters.Alpha.Opacity = min;
}
else
obj.filters.Alpha.Opacity += -number;
test1.innerText = "img1:"+img1.filters.Alpha.Opacity;
test2.innerText = "img2:"+img2.filters.Alpha.Opacity;
}
</script>
</head>
<body>
<img id='img1' src=" http://bbs.51js.com/images/standard/51js.gif" style="filter:Alpha(Opacity=10)" onmouseover="OnMouseOver(this)" onmouseout="OnMouseOut(this)">
<img id='img2' src=" http://bbs.51js.com/images/standard/51js.gif" style="filter:Alpha(Opacity=10)" onmouseover="OnMouseOver(this)" onmouseout="OnMouseOut(this)">
<div id='test1'>img1:10</div>
<div id='test2'>img2:10</div>
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值