3 Correctly handle PNG transparency in Win IE 5.5 & 6.
\r
4 http://homepage.ntlworld.com/bobosola. Updated 18-Jan-2006.
\r
6 Use in <HEAD> with DEFER keyword wrapped in conditional comments:
\r
8 <script defer type="text/javascript" src="pngfix.js"></script>
\r
13 var arVersion = navigator.appVersion.split("MSIE")
\r
14 var version = parseFloat(arVersion[1])
\r
16 if ((version >= 5.5) && (document.body.filters))
\r
18 for(var i=0; i<document.images.length; i++)
\r
20 var img = document.images[i]
\r
21 var imgName = img.src.toUpperCase()
\r
22 if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
\r
24 var imgID = (img.id) ? "id='" + img.id + "' " : ""
\r
25 var imgClass = (img.className) ? "class='" + img.className + "' " : ""
\r
26 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
\r
27 var imgStyle = "display:inline-block;" + img.style.cssText
\r
28 if (img.align == "left") imgStyle = "float:left;" + imgStyle
\r
29 if (img.align == "right") imgStyle = "float:right;" + imgStyle
\r
30 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
\r
31 var strNewHTML = "<span " + imgID + imgClass + imgTitle
\r
32 + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
\r
33 + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
\r
34 + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
\r
35 img.outerHTML = strNewHTML
\r
42 * Another IE fix, this one's for abbr/acronym tags
\r
44 document.documentElement.setAttribute("xmlns:acc", "http://www.w3.org/1999/xhtml");
\r
45 document.body.innerHTML = document.body.innerHTML.replace(/<abbr/gi, "<acc:abbr").replace(/<\/abbr/gi, "</acc:abbr");
\r