source: tags/release-1_5_0RC2/include/pngfix.js @ 2194

Last change on this file since 2194 was 905, checked in by chrisaga, 19 years ago

bug 176 fixed: need a javascript to handle transparent PNG background in IE

(tribute to Bob Osola http://homepage.ntlworld.com/bobosola/index.htm

display: fixed another IE childselector bug in Categories Management admin page

and improved display of this page in all browsers too.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.2 KB
Line 
1
2// Correctly handle PNG transparency in Win IE 5.5 or higher.
3// http://homepage.ntlworld.com/bobosola. Updated 02-March-2004
4
5function correctPNG() 
6   {
7   for(var i=0; i<document.images.length; i++)
8      {
9          var img = document.images[i]
10          var imgName = img.src.toUpperCase()
11          if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
12             {
13                 var imgID = (img.id) ? "id='" + img.id + "' " : ""
14                 var imgClass = (img.className) ? "class='" + img.className + "' " : ""
15                 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
16                 var imgStyle = "display:inline-block;" + img.style.cssText 
17                 if (img.align == "left") imgStyle = "float:left;" + imgStyle
18                 if (img.align == "right") imgStyle = "float:right;" + imgStyle
19                 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle               
20                 var strNewHTML = "<span " + imgID + imgClass + imgTitle
21                 + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
22             + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
23                 + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
24                 img.outerHTML = strNewHTML
25                 i = i-1
26             }
27      }
28   }
29window.attachEvent("onload", correctPNG);
Note: See TracBrowser for help on using the repository browser.