Is there a way to fix PNG image display problems on IE6?

  • Context: Suggestion 
  • Thread starter Thread starter zzzhhh
  • Start date Start date
zzzhhh
Messages
39
Reaction score
1
I'm still using IE6, which can not display PNG images with transparent background correctly. But the orignal PNG images can be shown correctly, such as those in https://www.physicsforums.com/showthread.php?t=8997. So, I wonder if the forum can restore the PNG format back to the orignal one, or, add the following codes into the <head>...</head> if IE is detected:

<script language="javascript">
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='image');\"></span>"
img.outerHTML = strNewHTML
i = i-1
}
}
}
window.attachEvent("onload", correctPNG);
</script>


Thanks!
 
Physics news on Phys.org
This is a known problem for IE6. I don't think it will be updated since there are newer browsers which are out there without the problem. Unfortunately, once newer browsers are released older ones tend to get left.
 
Kurdt said:
This is a known problem for IE6.

Correctly put: IE is a known problem :wink:
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
3K