手机
当前位置:查字典教程网 >编程开发 >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中为什么不透明了】相关文章:

AngularJS向后端ASP.NET API控制器上传文件

jQuery插件zepto.js简单实现tab切换

javascript搜索框效果实现方法

文本框栏目介绍

JQuery分屏指示器图片轮换效果实例

判断file框选择的是否为图片

简单获取键盘的KeyCode

用javascript制作放大镜放大图片

JavaScript实现斗地主游戏的思路

js实现文本框选中的方法

精品推荐
分类导航