visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Web :: Browser issues :: Knowledge Base : how to make PNG images transparent under Internet Explorer ? Fix the bug with transparency.


By: VGR France  Date: 02/05/2006 10:14:37  English  Points: 0 Status: Answered
Quality : Excellent
Answer :
Just generate HTML like this :

<!--[if gte IE 5.5000]> <script type="text/javascript" src="pngfix.js"></script> <![endif]-->



NB this KB entry uses this other one

The pngfix.js file would contain :

// Correctly handle PNG transparency in Win IE 5.5 or higher. // http://homepage.ntlworld.com/bobosola. Updated 02-March-2004 //VGR01052006 MOD beautified (indentation, code style, comments) function correctPNG() { for(var i=0; i<document.images.length; i++) { var img = document.images; var imgName = img.src.toUpperCase(); if (imgName.substring(imgName.length-3, imgName.length) == "PNG") { var imgID = (img.id) ? "id='" + img.id + "' " : ""; var imgClass = (img.className) ? "class='" + img.className + "' " : ""; var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "; var imgStyle = "display:inline-block;" + img.style.cssText ; if (img.align == "left") imgStyle = "float:left;" + imgStyle; if (img.align == "right") imgStyle = "float:right;" + imgStyle; if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle; var strNewHTML = "<span " + imgID + imgClass + imgTitle + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"; img.outerHTML = strNewHTML i = i-1 } // if PNG } // for images } // Procedure correctPNG window.attachEvent("onload", correctPNG);


Do register to be able to answer

EContact
browser fav
page generated in 329.516890 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page