admin管理员组文章数量:1205165
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?
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?
Share Improve this question edited Dec 27, 2011 at 17:43 Rob W 349k87 gold badges807 silver badges682 bronze badges asked Jun 4, 2009 at 9:17 user47322user47322 2- Which version of Prototype? I believe the latest version has IE8 compatibility fixes. – karim79 Commented Jun 4, 2009 at 9:30
- You need the 1.6.1 release candidate for IE8 support - it was added in RC2, current is RC3. – robertc Commented Jun 26, 2009 at 23:17
3 Answers
Reset to default 13Figured 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
.
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?
Also check that the script tag's type is "text/javascript". I had this error in IE8, and fixed it by changing the type= part of the script tag from "application/javascript" to "text/javascript".
本文标签: internet explorer39Object Expected39 Javascript error in IE8 when using prototypejsStack Overflow
版权声明:本文标题:internet explorer - 'Object Expected' Javascript error in IE8 when using prototype.js - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738699280a2107565.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论