我有一個從ActiveXObject繼承的Javascript對象/類。但是當我在Internet Explorer(版本8)中運行代碼時,出現這個奇怪的錯誤。Javascript Prototype繼承自ActiveXObject導致Internet Explorer中的錯誤
的錯誤是:「對象不支持此屬性或方法」
你能告訴我是什麼錯誤意味着&如何解決這個問題?
我的代碼是:
function XMLHandler(xmlFilePath)
{
this.xmlDoc = null;
this.xmlFile = xmlFilePath;
this.parseXMLFile(this.xmlFile);
this.getXMLFile = function()
{
return this.xmlFile;
}
}
XMLHandler.prototype = new ActiveXObject("Microsoft.XMLDOM");
XMLHandler.prototype.constructor = ActiveXObject; // Error occurs here in IE. The error is: "Object doesn't support this property or method"
XMLHandler.prototype.parseXMLFile = function(xmlFilePath) // If I comment out the above line then the exact same error occurs on this line too
{
this.xmlFile = xmlFilePath;
this.async="false"; // keep synchronous for now
this.load(this.xmlFile);
}
什麼版本的IE? – SLaks
@SLaks我的版本是IE 8 –