手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >js png图片(有含有透明)在IE6中为什么不透明了
js png图片(有含有透明)在IE6中为什么不透明了
摘要:复制代码代码如下:functioncorrectPNG()//correctlyhandlePNGtransparencyinWinIE5....

复制代码 代码如下:

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.

{

var arVersion = navigator.appVersion.split("MSIE")

var version = parseFloat(arVersion[1])

if ((version >= 5.5) && (document.body.filters)) {

for (var j = 0; j < document.images.length; j++) {

var img = document.images[j]

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

+ " + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"

+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"

+ "(src='" + img.src + "', sizingMethod='scale');"></span>"

img.outerHTML = strNewHTML

j = j - 1

}

}

}

}

window.attachEvent("onload", correctPNG);

【js png图片(有含有透明)在IE6中为什么不透明了】相关文章:

让插入到 innerHTML 中的 script 跑起来的实现代码

js实现两点之间画线的方法

JavaScript的Backbone.js框架的一些使用建议整理

浅谈利用JavaScript进行的DDoS攻击原理与防御

popdiv

分享十五款 jQuery 社交网络分享插件

理解javascript定时器中的单线程

nodejs修复ipa处理过的png图片

让innerHTML的脚本也可以运行起来

JavaScript中substring()方法的使用

精品推荐
分类导航