Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Suggestion PNG image display problem

  1. Oct 11, 2009 #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!
     
  2. jcsd
  3. Oct 11, 2009 #2

    Kurdt

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    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.
     
  4. Oct 12, 2009 #3

    Borek

    User Avatar

    Staff: Mentor

    Correctly put: IE is a known problem :wink:
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: PNG image display problem
  1. Displaying pi (Replies: 3)

Loading...