xml经典的例子怎么在我机子上不出来啊?
readxml.html
<!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 ">
<head>
<script language= "JavaScript " for= "window " event= "onload ">
var xmlDoc = new ActiveXObject( "Microsoft.XMLDOM ");
xmlDoc.async= "false ";
xmlDoc.load( "file.xml ");
nodes = xmlDoc.documentElement.childNodes;
title.innerHtml = nodes.item(0).text;
author.innerHtml = nodes.item(1).text;
email.innerHtml = nodes.item(2).text;
date.innerHtml = nodes.item(3).text;
</script>
<title> 在HTML中调用XML数据 </title>
</head>
<body bgcolor= "#FFFFFF ">
<b> 标题: </b>
<span id= "title "> </span>
<b> 作者: </b> >
<span id= "author "> </span>
<b> 信箱: </b>
<span id= "email "> </span>
<b> 日期: </b>
<span id= "date "> </span>
</body>
</html>
file.xml
<?xml version= "1.0 " encoding= "GB2312 "?>
<myfile>
<title> XML轻松学习手册 </title>
<author> asdfsadfsadfsadf </author>
<email> ajie@aolhoo.com </email>
<date> 20010115 </date>
</myfile>
试了半天也不出来啊.
显示的是
标题: 作者: > 信箱: 日期:
请问这是怎么回事?
[解决办法]
注意大小写及集合的用法。
<script language= "JavaScript " for= "window " event= "onload ">
var xmlDoc = new ActiveXObject( "Microsoft.XMLDOM ");
xmlDoc.async= "false ";
xmlDoc.load( "file.xml ");
nodes = xmlDoc.documentElement.childNodes;
title.innerHTML = nodes[0].text;
author.innerHTML = nodes[1].text;
email.innerHTML = nodes[2].text;
date.innerHTML = nodes[3].text;
</script>