以文本方式查看主题

-  计算机科学论坛  (http://bbs.xml.org.cn/index.asp)
--  『 XML基础 』  (http://bbs.xml.org.cn/list.asp?boardid=1)
----  看看哪里错了?  (http://bbs.xml.org.cn/dispbbs.asp?boardid=1&rootid=&id=13028)


--  作者:weikunlun
--  发布时间:12/27/2004 9:03:00 AM

--  看看哪里错了?
<html>
<head>
<script language="javascript" for="window" event="onload">
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.load("myfile.xml");
nodes = xmlDoc.documentElement.childNodes;
title.innerText = nodesitem(0).text;
author.innerText = nodes.item(1).text;
email.innerText = nodes.item(2).text;
date.innerText = 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>

myfile.xml:
<?xml version="1.0" encoding="GB2312"?>
<myfile>
<title>轻松学习手册</title>
<author>ajie</author>
<email>ajie@aolhoo.com</email>
<date>20010115</date>
</myfile>

在网页上显示不出来?


--  作者:admin
--  发布时间:12/27/2004 1:00:00 PM

--  
title.innerText = nodesitem(0).text;
改为
title.innerText = nodes.item(0).text;
W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
31.250ms