PNG Image rendering

Status
Not open for further replies.

ziycon

New Member
I'm confused, why don't PNG image render properly in any IE browser, i've tried using gif as the image has now background but a gif is not sharp enough, the PNG renders perfect in FF 3 and i need it to do like wise in Ie, any work arounds or suggestions?
 

Forbairt

Teaching / Designing / Developing
PNG in Windows IE

though you'll still probably need to hack any css you're got with pngs in them (assuming what you're on about is transparency) ?
 

ziycon

New Member
PNG in Windows IE

though you'll still probably need to hack any css you're got with pngs in them (assuming what you're on about is transparency) ?
I've done everything it says here but it wont, work, am i doing something wrong, heres what i have on the page:
Code:
<!--[if lt IE 7]>
<script language="JavaScript">
function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])
   if ((version >= 5.5) && (document.body.filters)) 
   {
      for(var i=0; i<document.images.length; i++)
      {
         var img = document.images[i]
         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
         }
      }
   }    
}
window.attachEvent("onload", correctPNG);
</script>
<![endif]-->
 
Status
Not open for further replies.
Top