2008-05-10
忙+透明PNG在IE6下的官方解决方案
关键字: js, png五一短假,累的不行,回了一趟武汉.赶回北京后,公司又组织去了慕田峪长城春游,接着便是忙碌的一周工作,五日到公司报到后马上收到一堆BUG清单,并立即开始了修复工作.下班后去了健身房段练身体,毕竟身体才是革命的本钱..总之这周很忙碌.
当然还有个更郁闷的事,公司将内外网络隔离了,上班时间不准上外网,唉.这是什么世道啊..所以博客有十多天没有更新了.公司系统BUG修复任务没有快速完成,使得python和Django的学习也停滞了.下周要重新捡起来.
晚上上网发现一个好文章,也是以前做美工工作时常遇到的,在这里顺便记录一下吧:
(www.gowindowslive.com上发现的解决方案),代码如下
/*
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 >= 5.5 && version < 7.0) && (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") > 0) {
var width = img.width;
var height = img.height;
var sizingMethod = (img.className.toLowerCase().indexOf("scale") >= 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;
}
}
}
}
fixPng();
发表评论
- 浏览: 4256 次
- 性别:

- 来自: 北京

- 详细资料
搜索本博客
最近加入圈子
最新评论
-
Googlipse-不错的GWT Ecli ...
呵呵...我又下个designer超爽
-- by lutsao -
Googlipse-不错的GWT Ecli ...
to lutsao: 可能是我没有翻译清楚,我的E文也一般,还是到官网上入门教 ...
-- by lyhapple -
Googlipse-不错的GWT Ecli ...
下了 可是不知咋用。。。
-- by lutsao -
Googlipse-不错的GWT Ecli ...
Googlipse is no more. The code base is n ...
-- by linuxcoffee -
安全有效的实现两星期内自 ...
晕,,我发的时候明明发全了..我重发一次吧...估计是字数限制的原因
-- by lyhapple






评论排行榜