2012-09-28 80 views
0

此代碼段是創建新的對象,它工作正常,在其他瀏覽器IE,但9SCRIPT438:對象不支持屬性或方法「創造」 - IE9

function Item(no, name, qty, lineNo) {¬ 
     this.no = no;¬ 
     this.name = name;¬ 
     this.qty = qty;¬ 
     this.lineNo = lineNo;¬ 
    }¬ 
    Item.prototype = Object.create(null);¬ // error this line 

我怎樣才能解決這個問題?

+1

http://stackoverflow.com/questions/2709612/using-object-create-instead-of-new這將幫助你...在某些瀏覽器中不支持Object.create() – Apurv

回答

0

根據MSDN

的Object.create:

支持在下面的文檔模式:互聯網瀏覽器9級的標準, 的Internet Explorer 10標準,和Internet Explorer 11個標準。在以下文檔模式下不支持 :Quirks,Internet Explorer 6標準,Internet Explorer 7標準,Internet Explorer 8標準。

因此,當您使用IE9檢查兼容模式,如果它設置爲standardsQuirks

相關問題