<?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>
它给出了这样的错误
网页错误详情
用户代理:Mozilla/4.0(兼容;MSIE 8.0;Windows NT 6.1;Trident/4.0;SLCC2;.NET CLR 2.0.50727;.NET CLR 3.5.30729;.NET CLR 3.0.30729;Media Center PC 6.0;InfoPath。 2) 时间戳:2013 年 1 月 11 日星期五 14:33:05 UTC
消息:“ActiveXOjbect”未定义行:19 字符:5 代码:0 URI:file:///D:/Priyal/Personal/Programing/XHTML/XML/School.html
消息:“ActiveXOjbect”未定义行:19 字符:5 代码:0 URI:file:///D:/Priyal/Personal/Programing/XHTML/XML/School.html