Getting Google Chrome to Ignore IE Javascript

Posted by swajak on Stack Overflow See other posts from Stack Overflow or by swajak
Published on 2009-09-28T16:38:31Z Indexed on 2010/04/27 22:03 UTC
Read the original article Hit count: 243

Filed under:
|
|
|

I'm creating a slideshow using javascript that fades images. Awhile back, I discovered that to change the opacity of an image, I have to use a different API, depending on whether the page is viewed in Firefox or IE.

Firefox:

img.style.opacity = [value 0 to 1];

IE:

img.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity= [value 0 to 100] )";

So, currently, I use <script LANGUAGE="JScript"> for code that is meant for IE. This was suggested in the Mozilla docs.

The problem: Chrome thinks my <script LANGUAGE="JScript"> code is valid, when it is not.

How to make Chrome ignore the code inside <script LANGUAGE="JScript"> ? Or how to make my opacity code cross-browser?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about chrome