<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
#img1 {filter:alpha(opacity:30); opacity:0.3;}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
window.onload=function ()
{
var oImg=document.getElementById('img1');
oImg.onmouseover=function ()
{
startMove(100);
}
oImg.onmouseout=function ()
{
startMove(30);
}
}
var timer=null;
var alpha=30;
function startMove(iTarget)
{
var oImg=document.getElementById('img1');
clearInterval(timer);
timer=setInterval(function (){
var iSpeed=0;
if(alpha<iTarget)
{
iSpeed=1;
}
else
{
iSpeed=-1;
}
if(alpha==iTarget)
{
clearInterval(timer);
}
else
{
alpha+=iSpeed;
oImg.style.filter='alpha(opacity:'+alpha+')';
oImg.style.opacity=alpha/100;
document.title=alpha;
}
}, 30);
}
</script>
</head>
<body>
<img id="img1" src="Desert.jpg" />
</body>
</html>
图盘淡入淡出的效果,比不上css3 一个样式,很是无语!