javascript基础
[code=JScript]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN " "http://www.w3.org/TR/html4/loose.dtd ">
<html>
<head>
<meta http-equiv= "Content-Type " content= "text/xml; charset=UTF-8 ">
</head>
<body>
<script type= "text/javascript ">
function createDocument() {
if(typeof arguments.callee.activeXString != "string ") {
var versions = [ "MSXML2.DOMDocument.6.0 ", "MSXML2.DOMDocument.3.0 ", "MSXML2.DOMDocument "];
for(var i=0,len=versions.length;i <len;i++) {
try {
var xmldom = new ActiveXObject(version[i]);
arguments.callee.activeXString = version[i];
return xmldom;
}catch(ex) {
//版本无效
}
}
}
return new ActiveXObject(arguments.callee.activeXString);//类型不匹配
}
var xmldom = createDocument();
xmldom.loadXML( " <root> <child/> </root> ");
alert(xmldom.documentElement.tagName);
alert(xmldom.documentElement.firstChild.tagName);
</script>
[/code]
"return new ActiveXObject(arguments.callee.activeXString); "出现类型不匹配错误是怎么回事?
------解决方案--------------------
ActiveXObject(arguments.callee.activeXString)那你就看看这个后面接受的是什么参数撒....
------解决方案--------------------
说明你系统中
MSXML2.DOMDocument.6.0
MSXML2.DOMDocument.3.0
MSXML2.DOMDocument
这三个组件都无法创建, 不存在或者无权限
而你又未传入要创建的另外的权限, 参数为空
所以当三个组件都失败时, 创建你传入的第四个组件, 是空, 就会出错