Solved

PNG for every browser EXCEPT MSIE

Posted on 2006-07-09
3
193 Views
Last Modified: 2008-03-17
Hello.

I have two versions of the image 'balloon.png'.

The .PNG looks better but it does not work properly on MSIE because it has an alpha-transparency.

So I want to serve the UGLY .GIF to MSIE users but the .PNG to everyone else.

Right now I use this to display the PNG version:
                    document.writeln("<img src='balloon.png' onmouseover='fix(\""+j+"\");'>");


I need something like this, but my syntax is off...

                    if (browser==MSIE) imgExt=".gif" else imgExt=".png"
                    document.writeln("<img src='balloon."+imgExt+"' onmouseover='fix(\""+j+"\");'>");


Any ideas  how?

Thanks!

0
Comment
Question by:hankknight
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
sam85281 earned 500 total points
ID: 17068944
if (navigator.appName == 'Microsoft Internet Explorer') {
// do this
} else {
//do this
}

-Sam
0
 
LVL 16

Expert Comment

by:sam85281
ID: 17068956
By the way, you CAN use a PNG in IE with a little simple scripting.

This tells all:

http://homepage.ntlworld.com/bobosola/

-Sam
0
 
LVL 16

Author Comment

by:hankknight
ID: 17069238
Thanks!

I accepted you first comment as the answer because it directly answers my question, but I will be using the IE PNG fix as a solution.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question