<html xmlns="http://www.w3.org/1999/xhtml"> <head> <Meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> <style> #div1{width:200px;height:200px;filter:alpha(opacity:30);opacity:0.3;} </style> <script> window. () { var oDiv=document.getElementById('div1'); oDiv. () { startMove(100); }; oDiv. () { startMove(30); }; }; var timer=null; var alpha=30; function startMove(number) { var oDiv=document.getElementById('div1'); clearInterval(timer); timer=setInterval(function () { var speed=0; if(alpha<number) { speed=5; } else { speed=-5; } if(alpha==number) { clearInterval(timer); } else { alpha+=speed; oDiv.style.filter='alpha(opacity='+alpha+')'; oDiv.style.opacity=alpha/100; } },30); }; </script> </head> <body> </body> <div id="div1"> <img src="file:///E|/250-chocolate-19-momme-seamless-silk-bedding-set-cymbidium-02.jpg" /> </div> </html>