您的位置:首页 > 其它

Web上IMG淡入淡出的HTC封装

2004-07-27 14:00 351 查看
<style>
IMG
{
behavior:url('Img.htc');
}
</style>
Img.htc
<PUBLIC:COMPONENT>
<PUBLIC:attach event="ondocumentready" onevent="Init()"/>
<PUBLIC:attach event="onmouseover" onevent="DefineOn()"/>
<PUBLIC:attach event="onmouseout" onevent="DefineOff()"/>
<PUBLIC:method name="DefineInit"/>
<script>
style.filter="alpha(opacity=20)";
var timer;
var initOffset;
var onOffset=5;
var offOffset=10;//偏移量
function Init()
{
initOffset=element.filters.alpha.opacity;
}
function DefineOn()
{
clearInterval(timer)
timer=window.setInterval("document.all['"+element.uniqueID+"'].DefineInit(0)",10);
}
function DefineOff()
{
clearInterval(timer)
timer=window.setInterval("document.all['"+element.uniqueID+"'].DefineInit(1)",10);
}
function DefineInit(bStatus)
{
opacty=element.filters.alpha.opacity;
if(bStatus)
{
if(opacty>initOffset)
{
element.filters.alpha.opacity-=offOffset;
}
else
{
clearInterval(timer);
}
}
else
{
if(opacty<100)
{
element.filters.alpha.opacity+=offOffset;
}
else
{
clearInterval(timer);
}
}
}
</script>
</PUBLIC:COMPONENT>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐