<script type="text/javascript">
var xmlDoc;
function loadXML(){
if(document.implementation&&document.implementation.createDocument)
{
xmlDoc=document.implementation.createDocument("","",null);
xmlDoc.load("test.xml");
xmlDoc.onload=getmessage();
}
else{
alert("Your browser cannot handle this script");
}
}
function getmessage(){
var nodes=xmlDoc.getElementsByTagName("note");
alert(nodes.length);
}
</script><br/>
test.xml<br/>
<?xml version="1.0" encoding="gb2312" ?>
<note>
<to>gww</to>
<from>dan dan</from>
<body>Hello world</body>
</note>
<note>
<to>aa</to>
<from>bb</from>
<body>Hello to mars</body>
</note>
<br/>请问该怎么取note节点下的子结点呢 ?这个是在ff下。
var xmlDoc;
function loadXML(){
if(document.implementation&&document.implementation.createDocument)
{
xmlDoc=document.implementation.createDocument("","",null);
xmlDoc.load("test.xml");
xmlDoc.onload=getmessage();
}
else{
alert("Your browser cannot handle this script");
}
}
function getmessage(){
var nodes=xmlDoc.getElementsByTagName("note");
alert(nodes.length);
}
</script><br/>
test.xml<br/>
<?xml version="1.0" encoding="gb2312" ?>
<note>
<to>gww</to>
<from>dan dan</from>
<body>Hello world</body>
</note>
<note>
<to>aa</to>
<from>bb</from>
<body>Hello to mars</body>
</note>
<br/>请问该怎么取note节点下的子结点呢 ?这个是在ff下。
解决方案 »
- 左键直接点击下载链接 实现右键点击再另存为两个步骤
- 高人进,问一下类似 QQ空间 或 人人什么的。 好友更新是如何收到的?
- 符号$在js脚本中表示什么含义
- 关于 js 拼接 ,请大侠帮忙
- Input hidden 有什么用
- 请问一个动态加载页面的问题, 恳求解答.
- 请教一个DOM的问题
- jquery after重复添加2次
- 在页面中嵌入iframe,可以让iframe的长度随着其中的内容增多而自动加长嘛,不想出现滚动条。请指教!
- 如何做到单击一个链向*.mp3的链接就打开winamp来播放,和单击rm打开realplayer?
- 纯web技术的工作流交流圈子
- 招聘兼职 JavaScript 开发高手(地域不限)
楼主【gwwnha】截止到2008-07-02 12:15:44的历史汇总数据(不包括此帖):
发帖的总数量:8 发帖的总分数:250
结贴的总数量:3 结贴的总分数:110
无满意结贴数:0 无满意结贴分:0
未结的帖子数:5 未结的总分数:140
结贴的百分比:37.50 % 结分的百分比:44.00 %
无满意结贴率:0.00 % 无满意结分率:0.00 %
楼主该结一些帖子了