source: trunk/phpgwapi/templates/edge-it/js/pngfix.js @ 2

Revision 2, 1.3 KB checked in by niltonneto, 17 years ago (diff)

Removida todas as tags usadas pelo CVS ($Id, $Source).
Primeira versão no CVS externo.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1function correctPNG() // correctly handle PNG transparency in Win IE 5.5 or higher.
2{
3        for(var i=0; i<document.images.length; i++)
4        {
5                var img = document.images[i]
6                var imgName = img.src.toUpperCase()
7                if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
8                {
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                        var imgAttribs = img.attributes;
14                        for (var j=0; j<imgAttribs.length; j++)
15                        {
16                                var imgAttrib = imgAttribs[j];
17                                if (imgAttrib.nodeName == "align")
18                                {
19                                        if (imgAttrib.nodeValue == "left") imgStyle = "float:left;" + imgStyle
20                                        if (imgAttrib.nodeValue == "right") imgStyle = "float:right;" + imgStyle
21                                        break
22                                }
23                        }
24                        var strNewHTML = "<span " + imgID + imgClass + imgTitle
25                        strNewHTML += " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
26                        strNewHTML += "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
27                        strNewHTML += "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
28                        img.outerHTML = strNewHTML
29                        i = i-1
30                }
31        }
32}
33window.attachEvent("onload", correctPNG);
Note: See TracBrowser for help on using the repository browser.