View Full Version : I hate Javascript part 1 (&CSS) -conditional statement sort of working

24-05-2010, 02:54 PM

example page with problem (http://nigel.geek.nz/sbo_shop/index.php?main_page=index&cPath=823_527_213)

Provided you aren't in Internet Explorer this should work fine, if you are in Internet explorer when you hover over an image, you will see the popupimage in a grey window with a big hunk of white to the right of it. Thats what i want to get rid of.

The javascript that controls the pop ups
There are 2 versions of the script,
One works perfectly in IE
One works in other browsers

Currently they are both in the same JS file

but with the following selector

var stIsIE = /*@cc_on!@*/false;
if (stIsIE) {
//IE Version of script
alert("I am IE!");
} else {
// non IE version
alert("I am Not IE!");

When i go to the site in a non IE browser the site works as you would expect, a javascipt alert says "I am Not IE" etc
Now this is where it gets fun
If i go to that page in IE the Alert says "I am IE", however the code seems to be the non IE Code.

If i remove all the code from the JS file except the IE specific code, IE works fine, however once i put it back the if Statement and the NON IE code, Internet explorer seems to use the NON IE code although the pop still says "I am IE", i am baffled it should work