2012-07-27 63 views
1

我已經瀏覽了很多關於此問題的其他問題,但我一直無法找到任何有助於解決特定問題的內容。我已經嘗試了很多沒有幫助的建議...「對象不支持此屬性或方法」在IE中

以下是我與合作正顯示出了錯誤(當然,只有在IE瀏覽器,它在Chrome和FF正常工作) :

var Lights = {}; 
var light_data = { 
    id: "", 
    location: "", 
    week: [], 
    stats: [], 
    run: function(){ 
     run_statistics(); 
    } 
} 

Lights.APIEvents = Object.create(light_data); //complains about this line 

我想創建一個燈的性能light_data對象...但它不工作,並抱怨說,對象不支持它..任何想法?

非常感謝您的幫助!

+2

錯誤/代碼在哪裏? – PhD 2012-07-27 16:42:48

+1

也發佈一些代碼。 – Shreedhar 2012-07-27 16:42:52

+1

我想你忘了發佈你的代碼。 – 2012-07-27 16:44:09

回答

3

你叫Object.create

if (typeof Object.create !== 'function') { 
    Object.create = function (o) { 
     function F() {} 
     F.prototype = o; 
     return new F(); 
    }; 
} 

所以Object.create將在IE工作太之前就用這個。

+0

這個伎倆!謝謝!! – user1558257 2012-07-27 17:03:42

+0

不客氣:-) – 2012-07-27 17:04:04

+2

當然現在它在那裏工作,我發現了更多的問題......但那些我應該能夠修復。古迪:P. – user1558257 2012-07-27 17:05:36

相關問題