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
if (navigator.userAgent.indexOf('MSIE') == -1)
8
if (navigator.userAgent.indexOf('MSIE 5')>0 && navigator.userAgent.indexOf('MSIE 5.5')==-1)
9
return; // don't break IE 5.0
11
var img = document.images[i]
12
var imgName = img.src.toUpperCase()
13
if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
15
var imgID = (img.id) ? "id='" + img.id + "' " : ""
16
var imgClass = (img.className) ? "class='" + img.className + "' " : ""
17
var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
18
var imgStyle = "display:inline-block;" + img.style.cssText
19
var imgAttribs = img.attributes;
21
for (var j=0; j<imgAttribs.length; j++)
23
var imgAttrib = imgAttribs[j];
24
if (imgAttrib.nodeName == "align")
26
if (imgAttrib.nodeValue == "left") imgStyle = "float:left;" + imgStyle
27
if (imgAttrib.nodeValue == "right") imgStyle = "float:right;" + imgStyle
29
else if (imgAttrib.nodeName == "onclick")
30
imgEvents += " onClick='" + imgAttrib.nodeValue + "'";
31
else if (imgAttrib.nodeName == "onmouseover")
32
imgEvents += " onMouseOver='" + imgAttrib.nodeValue+ "'";
33
else if (imgAttrib.nodeName == "onmouseout")
34
imgEvents += " onMouseOut='" + imgAttrib.nodeValue+ "'";
36
var strNewHTML = "<span " + imgID + imgClass + imgTitle + imgEvents
37
strNewHTML += " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
38
strNewHTML += "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
39
strNewHTML += "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
40
img.outerHTML = strNewHTML