代码如下 | 复制代码 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>New document</title> <style type="text/css"> <!-- div#div1 { height:240px;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=20);} --> </style> </head> <body> <div id="div1"> <img src="2.jpg" alt=""/> </div> <select onchange="changeAlpha(this.value)"> <option>选择透明度</option> <option value="20">20</option> <option value="40">40</option> <option value="60">60</option> <option value="80">80</option> </select> </body> </html> <script language="JavaScript" type="text/javascript"> <!-- function changeAlpha(value){ var div1=document.getElementById("div1"); //设置透明滤镜的透明度属性 div1.filters[0].opacity=value; } //--> </script> |
时间: 2024-11-24 00:33:44