source: tags/release-1_6_0RC1/include/pngfix.js @ 12523

Last change on this file since 12523 was 948, checked in by chrisaga, 19 years ago
  • report bug 206 correction and some template improvement from branch 1.5
  • feature 195 : add an "Admin" link under "Home" in the menu bar of the admin page
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.3 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      if (img.className == "button" || img.className == "icon")
11          {
12          var imgName = img.src.toUpperCase()
13          if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
14             {
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                 if (img.align == "left") imgStyle = "float:left;" + imgStyle
20                 if (img.align == "right") imgStyle = "float:right;" + imgStyle
21                 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle               
22                 var strNewHTML = "<span " + imgID + imgClass + imgTitle
23                 + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
24             + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
25                 + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
26                 img.outerHTML = strNewHTML
27                 i = i-1
28             }
29          }
30      }
31   }
32window.attachEvent("onload", correctPNG);
Note: See TracBrowser for help on using the repository browser.