]>
git.ipfire.org Git - people/shoehn/ipfire.org.git/blob - static/js/correctpng.js
1 function correctPNG() // correctly handle PNG transparency in Win IE 5.5 or higher.
3 for(var i
=0; i
<document
.images
.length
; i
++)
5 var img
= document
.images
[i
]
6 var imgName
= img
.src
.toUpperCase()
7 if (imgName
.substring(imgName
.length
-3, imgName
.length
) == "PNG")
9 var imgID
= (img
.id
) ? "id='" + img
.id
+ "' " : ""
10 var imgClass
= (img
.className
) ? "class='" + img
.className
+ "' " : ""
11 var imgTitle
= (img
.title
) ? "title='" + img
.title
+ "' " : "title='" + img
.alt
+ "' "
12 var imgStyle
= "display:inline-block;" + img
.style
.cssText
13 if (img
.align
== "left") imgStyle
= "float:left;" + imgStyle
14 if (img
.align
== "right") imgStyle
= "float:right;" + imgStyle
15 if (img
.parentElement
.href
) imgStyle
= "cursor:hand;" + imgStyle
16 var strNewHTML
= "<span " + imgID
+ imgClass
+ imgTitle
17 + " style=\"" + "width:" + img
.width
+ "px; height:" + img
.height
+ "px;" + imgStyle
+ ";"
18 + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
19 + "(src=\'" + img
.src
+ "\', sizingMethod='scale');\"></span>"
20 img
.outerHTML
= strNewHTML
25 window
.attachEvent("onload", correctPNG
);