views:

8007

answers:

5
function icPageInit()
{
    $("icImgDiv" + icAlternate()).setOpacity(0);
    return true;
}
window.onload = icPageInit;

This piece of Javascript code works fine in Firefox and Chrome, but fails with the error 'Object Expected' in Internet Explorer 8. IE8 says the error occurs on line 3 of the above code.

Does anyone know why this is happening, and/or how to get it working?

+1  A: 

Are you sure that this: $("icImgDiv" + icAlternate()) returns a reference to an element? If so, have you tried using Microsoft Script Debugger / Visual Studio to debug when and where the exception is raised?

PatrikAkerstrand
+3  A: 

Figured it out.

Turns out Internet Explorer chokes if you use anything other than "javascript" in the language attribute of the script tag.

I was using version numbers appended onto javascript in the language attribute, which was causing IE not to load prototype.js.

Charlie Somerville
A: 

This is not the problem. IE8 has that bug I guess... Because its working fine with IE7 and other Browser.

Turns out Internet Explorer chokes if you use anything other than "javascript" in the language attribute of the script tag.

I was using version numbers appended onto javascript in the language attribute, which was causing IE not to load prototype.js.

Zaver
A: 

i tried everything and i can't make it work in IE. mozilla works fine...

any suggestions?

thanks

Leeloo
A: 

I have had the same problem . user only for JavaScript and not .

John Kamuchau