使用png格式的ie5.5或浏览器 使用png格式的ie5.5或浏览器 Richard Williams - 2009年7月2日
我发现这允许Windows即5.5和IE 6.
添加下面的Java脚本网页到您的根文件夹.
/*
Correctly handle PNG transparency in Win IE 5.5 & 6.
http://homepage.ntlworld.com/bobosola. Updated 18-Jan-2006.
Use in <HEAD> with DEFER keyword wrapped in conditional comments:
<!--[if lt IE 7]>
<script defer type="text/javascript" src="pngfix.js"></script>
<![endif]-->
*/
var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])
if ((version >= 5.5) && (document.body.filters))
{
for(var i=0; i<document.images.length; i++)
{
var img = document.images[i]
var imgName = img.src.toUpperCase()
if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
{
var imgID = (img.id) ? "id='" + img.id + "' " : ""
var imgClass = (img.className) ? "class='" + img.className + "' " : ""
var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
var imgStyle = "display:inline-block;" + img.style.cssText
if (img.align == "left") imgStyle = "float:left;" + imgStyle
if (img.align == "right") imgStyle = "float:right;" + imgStyle
if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
var strNewHTML = "<span " + imgID + imgClass + imgTitle
+ " style="" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
+ "(src='" + img.src + "', sizingMethod='scale');"></span>"
img.outerHTML = strNewHTML
i = i-1
}
}
}
然后拷贝到你的头 html
<!--[if lt IE 7.]>
<script defer type="text/javascript" src="pngfix.js"></script>
<![endif]-->
理查德威廉姆斯
重新: 使用png格式的ie5.5或浏览器 Fernando Mol - 07-04-2009
好后, 理查德. 我不知道这种东西可以添加到常见问题解答.
重新: 使用png格式的ie5.5或浏览器 Richard Williams - 07-04-2009
它可以做, 但我还没有测试,我自己, 所以等待有人评论,如果工程第一...
理查德威廉姆斯
重新: 使用png格式的ie5.5或浏览器 Kristen Dormaier - 07-07-2009
我不能让它的工作. 虽然我还没有得到任何巴纽修复工作ie5.5或浏览器. 我会继续努力...
克里斯汀
重新: 使用png格式的ie5.5或浏览器 Richard Williams - 07-07-2009
您好克里斯汀,
你可以在这里分享你的代码,我们来看看,请...?
谢谢
理查德威廉姆斯
重新: 使用png格式的ie5.5或浏览器 Kira Woodmansee - 07-16-2009
哇, 感谢张贴的! 我只希望关于放弃pngs当我望着他们在IE.
吉良woodmansee
活动协调员, 巨石数字艺术
事件@ Boulderdigitalarts.com
http://www.Boulderdigitalarts.com