Solved

PNG for every browser EXCEPT MSIE

Posted on 2006-07-09
3
196 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

738 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