如何确定在JavaScript中创建的ActiveXObject和对象的类型?

时间:2015-03-20 19:35:01

标签: javascript internet-explorer object activex activexobject

1)

说我在JavaScript中有以下内容:

var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.6.0");
var xmlDoc2 = new ActiveXObject("Msxml2.DOMDocument.3.0");
var xmlDoc3 = new ActiveXObject("Microsoft.XMLDOM");

typeof xmlDoc;  // returns object
typeof xmlDoc2; // returns object
typeof xmlDoc3; // returns object

如何返回每个ActiveXObject的类型,即Msxml2.DOMDocument.6.0Msxml2.DOMDocument.3.0?我想观察xmlDoc的ActiveXObject是否等于xmlDoc2' s ActiveXObject

2)

 // object XMLDocument
 var xmlObj = document.implementation.createDocument ("", "", null); 
 typeof xmlObj; // returns object

与ActiveXObject相同的情况,除了此对象定义为XMLDocument。我怎样才能验证它是XMLDocument?同样,typeof会返回 object ,这在这里并不实用。

非常感谢。

0 个答案:

没有答案