1. 找到COM的组件名,如"MSXML2.DOMDocument.3.0". 可以在注册表中去看.(HKEY_CLASSES_ROOT\...)
2. 在JS中创建对象:xmldoc = new ActiveXObject("MSXML2.DOMDocument.3.0");
3. 在对象上调用方法xmldoc.loadXML("xxxxxxx");
实例:查看MDACD版本.
Code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<body>
<script language="JavaScript">
<!--
var ver ;
ver = new ActiveXObject("MDACVer.Version");
alert (ver.Major);
//-->
</script>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<body>
<script language="JavaScript">
<!--
var ver ;
ver = new ActiveXObject("MDACVer.Version");
alert (ver.Major);
//-->
</script>
</body>
</html>