Javascript:错误'对象必需'。我无法破译它。你能?
我在我的一个网站上使用了一个名为“Facelift 1.2”的javascript,虽然该脚本适用于Safari 3,4b和Opera,OmniWeb和Firefox,但它并不适用于任何IE版本。
但即使在工作浏览器中我得到以下错误我无法破译。
也许在适当的时候 - 有更多的经验Javascript - 我将能够,但现在我想我会问你们中的一些人,在这里。
以下是我在IETester中测试Interet Explorer 6,7和8的页面时出现的错误弹出窗口:
IE错误弹出http://img21.imageshack.us/img21/3651/err2.png
以下内容来自Firefox 3.0.6中的Firebug控制台:
Firebug控制台日志http://img100.imageshack.us/img100/3636/err3.png
该网站是:http://www.457cc.co.nz/index.php如果它可以帮助您看到行动中提到的问题。
我也查了一下620对应的是:
“第76行”是:
this.isCraptastic = (typeof document.body.style.maxHeight=='undefined');
这是这段代码的一部分(取自flir.js):
// either (options Object, fstyle FLIRStyle Object) or (fstyle FLIRStyle Object)
,init: function(options, fstyle) { // or options for flir style
if(this.isFStyle(options)) { // (fstyle FLIRStyle Object)
this.defaultStyle = options;
}else { // [options Object, fstyle FLIRStyle Object]
if(typeof options != 'undefined')
this.loadOptions(options);
if(typeof fstyle == 'undefined') {
this.defaultStyle = new FLIRStyle();
}else {
if(this.isFStyle(fstyle))
this.defaultStyle = fstyle;
else
this.defaultStyle = new FLIRStyle(fstyle);
}
}
this.calcDPI();
if(this.options.findEmbededFonts)
this.discoverEmbededFonts();
this.isIE = (navigator.userAgent.toLowerCase().indexOf('msie')>-1 && navigator.userAgent.toLowerCase().indexOf('opera')<0);
this.isCraptastic = (typeof document.body.style.maxHeight=='undefined');
if(this.isIE) {
this.flirIERepObj = [];
this.flirIEHovEls = [];
this.flirIEHovStyles = [];
}
}
整个脚本也可以在我的服务器上找到:http://www.457cc.co.nz/facelift-1.2/flir.js
我只是不知道从哪里开始寻找错误,特别是因为它只影响IE,但在其余部分工作。也许你们有个主意。我很乐意听到他们。
谢谢阅读。
Jannis
PS:这是Opera的错误控制台报告:
JavaScript - http://www.457cc.co.nz/index.php
Inline script thread
Error:
name: TypeError
message: Statement on line 620: Cannot convert undefined or null to Object
Backtrace:
Line 620 of linked script http://www.457cc.co.nz/facelift-1.2/flir.js
document.body.appendChild(test);
Line 70 of linked script http://www.457cc.co.nz/facelift-1.2/flir.js
this.calcDPI();
Line 2 of inline#1 script in http://www.457cc.co.nz/index.php
FLIR.init();
stacktrace: n/a; see 'opera:config#UserPrefs|Exceptions Have Stacktrace'
没有找到相关结果
已邀请:
3 个回复
戒黑恳农
,所以
还没有定义。 在您链接的页面中,您应该将以下代码移动到页面底部(就在关闭html标记之前:
更好的是,您应该将初始化附加到文档的
事件。如果你这样做,你甚至不需要将你的javascript移动到文件的底部。使用jquery:
更多关于jquery的document.ready event&raquo;
冲汉
貉骂