Tilted Forum Project Discussion Community

Tilted Forum Project Discussion Community (https://thetfp.com/tfp/)
-   Tilted Technology (https://thetfp.com/tfp/tilted-technology/)
-   -   Need help with PNG file on website when viewing with IE (https://thetfp.com/tfp/tilted-technology/97492-need-help-png-file-website-when-viewing-ie.html)

ShaniFaye 11-15-2005 08:42 AM

Need help with PNG file on website when viewing with IE
 
Thanks to ngdawg she showed me how to take a file and make the background transparent by making it into a PNG file...unfortuantely it doesnt show up that way in IE.

I have researched and yes, I know this is a problem for IE versions under 7...my problem is for the life of me I cannot figure out how to add the "fix" code because I just dont understand it.

Is there anyone that can help me? Its just for ONE page, and for ONE image on that page.

spectre 11-15-2005 10:55 PM

I did a quick google and here's what I found.
You're going to want to copy and paste this part inside of your <head> </head> tags:
Code:

<!--[if gte IE 5.5000]>
  <script language="JavaScript"> var ie55up = true </script>
<![endif]-->
<script language="JavaScript">
function fixPNG(myImage) // correctly handle PNG transparency in Win IE 5.5 or higher.
  {
    if (window.ie55up)
        {
        var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
        var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
        var imgTitle = (myImage.title) ? "title='" + myImage.title + "' " : "title='" + myImage.alt + "' "
        var imgStyle = "display:inline-block;" + myImage.style.cssText
        var strNewHTML = "<span " + imgID + imgClass + imgTitle
        strNewHTML += " style=\"" + "width:" + myImage.width + "px; height:" + myImage.height + "px;" + imgStyle + ";"
        strNewHTML += "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
        strNewHTML += "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>"
        myImage.outerHTML = strNewHTML
        }
  }
</script>

And for the image itself:
Code:

<img src="your.png" height="15" width="21" onload="fixPNG(this)">
where your.png is your png file. And yes, you must include the height and width in the img tag.

ShaniFaye 11-16-2005 02:08 PM

I tried that and I couldnt get it to work....is there anything in that first bit I need to change? Thats the bit that was WAY confusing me

trache 12-08-2005 10:33 AM

ShaniFaye, don't forget that this fix simply won't work when people have JavaScript (or I guess scripting period in IE, I forget) disabled, period.

I think the new Firefox allows you to turn JavaScript on and off for certain domains, but I'm not sure about Internet Explorer <= 6.


All times are GMT -8. The time now is 09:40 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40