我有一个从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 –