首页 > Windows开发 > 详细

Day10----------alphaPic

时间:2014-11-29 23:03:19      阅读:271      评论:0      收藏:0      [点我收藏+]
 //----------使用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>

 

Day10----------alphaPic

原文:http://www.cnblogs.com/fleshy/p/4132129.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!