惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Recent Announcements
Recent Announcements
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
B
Blog
T
The Blog of Author Tim Ferriss
J
Java Code Geeks
腾讯CDC
D
Docker
G
Google Developers Blog
D
DataBreaches.Net
雷峰网
雷峰网
Blog — PlanetScale
Blog — PlanetScale
S
SegmentFault 最新的问题
The Cloudflare Blog
有赞技术团队
有赞技术团队
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Stack Overflow Blog
Stack Overflow Blog
大猫的无限游戏
大猫的无限游戏
量子位
美团技术团队
aimingoo的专栏
aimingoo的专栏
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Engineering at Meta
Engineering at Meta
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - 袁礼定

推荐网站: guship.cn 推荐网站: 开发测试教程 devqa.cn C#参考教程 http://www.csref.cn 最全的运营推广方案,教你如何从零开始运营APP SEO: Response.Redirect() 摘抄: Windows XP登录口令丢失的应急办法 随想 .net中统计时间的方法 zhaichao: 蔡文胜:站长之王 Sub String in Dos command Merge file using dos command Trip to America for 3 more months 明天的飞机,到美国培训和出差三个月,记一笔 javascript 游戏开发 乡村与城市的差别不是18年! 本人从事软件技术开发也有多年,打算先尝试往外迈一步试试! 在办公室里面不能访问部分.cn域名的网站,但不在办公室里面就能访问 汉字转拼音缩写的函数(C#) Get Sender Email Address from Outlook using CDO in C#
摘抄:透明PNG在IE6下的官方解决方案
袁礼定 · 2008-04-04 · via 博客园 - 袁礼定

摘自: http://www.cbmland.com/post/376/transparent-png-in-ie6-utility.html

做Web开发的朋友一定都知道PNG是一个相当不错的图片格式,但是这个好的格式却在IE6时代造成了麻烦,IE6会使透明的PNG的透明部分出现#DBEAED的色彩。透明不了。使得在FF下开发表现很好的界面换成IE浏览就惨不忍睹,又逼着换成GIF,而GIF的假透明在变换背景时造成毛边现象。

 刚去了www.gowindowslive.com去生成一个WLM的联系方式图标,结果发现的官方的解决方案。;)

核心函数贴出来供分析

 
/*
Correctly handle PNG transparency in Win IE 5.5 & 6.
Copyright 2007 Ignia, LLC
Based in part on code from from http://homepage.ntlworld.com/bobosola.
 
Use in  with DEFER keyword wrapped in conditional comments:
 
<script type="text/javascript" defer="true" src="pngfix.js"></script>
 
*/

 
function fixPng() {
  var arVersion = navigator.appVersion.split("MSIE")
  var version = parseFloat(arVersion[1])
 
  if ((version &gt;= 5.5 &amp;&amp; version &lt; 7.0) &amp;&amp; (document.body.filters)) {
    for(var i=0; i<document.images.length;></document.images.length;>      var img = document.images[i];
      var imgName = img.src.toUpperCase();
      if (imgName.indexOf(".PNG") &gt; 0) {
        var width = img.width;
        var height = img.height;
        var sizingMethod = (img.className.toLowerCase().indexOf("scale") &gt;= 0)? "scale" : "image";
        img.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + img.src.replace('%23', '%2523').replace("'", "%27") + "', sizingMethod='" + sizingMethod + "')";
        img.src="images/blank.gif" mce_src="images/blank.gif";
        img.width = width;
        img.height = height;
        }
      }
    }
  }