Day10----------alphaPic
//----------使用opacity属性完成对图片透明度渐变的效果
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <title></title> 6 </head> 7 <style type="text/css"> 8 img{height: 500px;width: 800px;margin: 20px 100px;filter:alpha(opacity:30);opacity: 0.3;} 9 </style> 10 <script type="text/javascript"> 11 window.onload=function(){ 12 var degree=0.3; 13 oImg=document.getElementsByTagName('img')[0]; 14 oImg.onmouseover=function(){ 15 setInterval(function(){ 16 degree+=0.05; 17 oImg.style.opacity=degree;//NIE; 18 oImg.style.filter="alpha(opacity:"+degree*100+")";//IE 19 },50); 20 } 21 } 22 </script> 23 <body> 24 <div><img src="pic/alpha.jpg"></div> 25 </body> 26 </html>