Forum Home
Press F1
 
Thread ID: 109814 2010-05-24 02:54:00 I hate Javascript part 1 (&CSS) -conditional statement sort of working Morgenmuffel (187) Press F1
Post ID Timestamp Content User
887557 2010-05-24 02:54:00 Ok

example page with problem (nigel.geek.nz)

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
Morgenmuffel (187)
1