信息:& # 39;ActiveXOjbect& # 39;是未定义的
Message: 'ActiveXOjbect' is undefined
<?xml version = "1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/tr/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml" xml:lang = "en" lang = "en">
<head>
<title>Finding Element Values in an XML Document</title>
<script language = "javascript" type = "text/javascript">
function getStudentData(){
var xmlDoc;
xmlDoc = new ActiveXOjbect("Microsoft.XMLDOM");
xmlDoc.load("School.xml");
nodeSchool = xmlDoc.documentElement;
nodeClass = nodeSchool.firstChild;
nodeStudents = nodeClass.lastChild;
nodeStudent = nodeStudents.lastChild;
nodeFirstName = nodeStudent.firstChild;
nodeLastName = nodeFirstName.nextSibling;
outputMessage = "Name: " + nodeFirstName.firstChild.nodeValue + " " + nodeLastName.firstChild.nodeValue;
message.innerHTML = outputMessage;
}
</script>
</head>
<body>
<center>
<h1>Finding Element Values in an XML Document</h1>
<div id = "message"></div>
<p>
<input type = "button" value = "Get Second Student's Name" onClick = "getStudentData()" />
</p>
</center>
</body>
</html>
给出如下错误
网页错误详情
User Agent: Mozilla/4.0 (compatible;MSIE 8.0;Windows NT 6.1;三叉戟/4.0;SLCC2;.net CLR 2.0.50727;.net CLR 3.5.30729;net CLR3.0.30729;Media Center PC 6.0;InfoPath.2) Timestamp: Fri, 11 Jan 2013 14:33:05 UTC
消息:' activexjject ' is undefined Line: 19 Char: 5 Code: 0 URI:文件:///D:/Priyal/个人/程序/XHTML/XML/School.html
消息:' activexjject ' is undefined Line: 19 Char: 5 Code: 0 URI:文件:///D:/Priyal/个人/程序/XHTML/XML/School.html
你打错了。
用ActiveXObject
代替ActiveXOjbect
但是你也应该注意到ActiveXObject
在Internet Explorer中只有可用。所有其他浏览器都会抛出相同的错误。
相关文章:
- 为什么“;未定义的“;在JavaScript中结束循环
- 要求未定义JS回调参数
- 如何检查管道中未定义的项目
- TypeError:无法读取属性'推'未定义的JavaScript
- $window.ga在AngularJS事件中未定义
- 未捕获的TypeError无法读取未定义的属性socialsharing
- 为什么grunt contrib connect的中间件选项的第三个参数是未定义的
- 无法获取属性'selectedIndex'的未定义引用或null引用
- 如何消除代码中的未定义和其他问题
- 未捕获的ReferenceError:$未定义
- this.router在AngularJS 2中未定义
- 未捕获的类型错误:无法读取属性'删除'的未定义
- 节点fs.stat名称未定义
- 尝试在PHP中回显输入文本时出现未定义的索引错误
- Jquery未定义函数正在停止其他操作
- AngularJS指令出错-无法读取属性'编译'的未定义
- 这.SOMETHING 总是返回未定义的 - extjs
- 无法获取属性'Id'使用Knockout.js的未定义或空引用API
- Wordpress中带有JQuery Accordion的未定义匿名函数
- 在不破坏未定义函数的情况下,对多个视图使用单个js文件