I am very new to Javascript... More of a php kinda guy. However I have a question regarding the old explorer browsers. I'm using transparent pngs on my site that rollover when the mouse hovers over them. Obviously the pngs are not looking so hot in the old explorer but looks awesome in chrome, safari, etc.

Option 1

Add Java script or Css to somehow allow old explorer to see the pngs correctly.

Option 2

if option 1 becomes to complicated ask the borrower to upgrade their browser by detecting

Does anybody have a good snippet of code for both options?

6 Years
Discussion Span
Last Post by Airshow

I am very new to Javascript...

That would definitely explain why you wrongly posted JavaScript question in Java Server Pages (JSP)

Post moved!



No amount of javascript or CSS can force a browser to display png images if it is not equipped to do so.

The simplest solution is to use gif images instead. Gifs support animation and transparency but not partial transparency.

If you want to give users of modern browsers the extra benefits of png whilst still providing limited support to older browsers, then you could try a "graceful degradation" approach. In this, failure to load a png would result in a second attempt to load a gif, and would require scripting in javascript, Success of this approach depends on whether the Image.onerror event fires on png failure in older browsers. I expect it does but have not tried it.


Edited by Airshow: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.