我在我的一個網站中使用了一個名爲'Facelift 1.2'的javascript,而這個腳本在Safari 3,4b和Opera,OmniWeb和Firefox中的工作原理並沒有在任何IE版本中使用。 但即使在工作瀏覽器中,我收到以下錯誤,我無法解密。Javascript:錯誤'Object Required'。我無法破譯它。你可以嗎?
也許在適當的時間 - 在事情上有更多的經驗Javascript-I將能夠,但現在我想我會問你們中的一些人,在這裏。
以下是錯誤彈出我IETester得到測試頁Interet資源管理器6,7和8: IE Error Pop Up http://img21.imageshack.us/img21/3651/err2.png
以下是Firebug控制檯在Firefox 3.0.6: Firebug Console Log 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'
差不多。包含該文件實際上並不訪問DOM。他在頁面中有一個腳本塊,它實際運行導致答案的init腳本。看到我的答案。 – Triptych 2009-02-26 21:21:29
感謝您的回答我不認爲我會想到它與頁面加載的任何時候都有關係。 – Jannis 2009-02-26 21:26:04