W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<html> <head> <style> img { filter:opacity(10%); } </style> <script type="text/javascript"> alpha = 50; function setImageAlpha(){ document.getElementById('myImage').style.WebkitFilter = 'opacity(' + alpha + '%)'; } function clean() { interval=setInterval("makeclean(myImage)",10) } function foggy() { clearInterval(interval); alpha=10; setImageAlpha(); } function makeclean() { if (alpha < 100) { alpha += 5; setImageAlpha(); } else if (window.interval) { clearInterval(interval) } } </script> </head> <body> <img id="myImage" src="/i/eg_landscape.jpg" onmouseover="clean()" onmouseout="foggy()" /> <b>请把鼠标移动到这个图像上</b> </body> </html>