获取XML的nodeValue使用Javascript [英] Getting XML nodevalue with Javascript
本文介绍了获取XML的nodeValue使用Javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图找出如何让在Javascript中一个节点的值。我读过一些教程,但他们使用的示例都是比我在做什么复杂得多。
I am trying to figure out how to get a node's value in Javascript. I've read a few tutorials but the examples they use are all much more complex than what I'm doing..
下面是我的JavaScript
Here's my Javascript
if(xmlhttpp.readyState==4 && xmlhttpp.status==200){
document.getElementById("ajax_status").innerHTML=xmlhttpp.responseXML.getElementsByTagName('status').nodeValue;
}
而XML是..
And the XML is..
<?xml version='1.0' encoding='UTF-8'?>
<resp><fname>Kyla</fname>
<lname>Bonds</lname>
<addr>6916 S Elizabeth Street</addr>
<city>Chicago</city>
<street>IL</street>
<zip>60636</zip>
<phone></phone>
<email>Kbonds20@gmail.com</email>
<status>Found user</status></resp>
我怎样才能从这种发现用户?
How can I get "Found User" from this?
推荐答案
尝试
xmlhttpp.responseXML.getElementsByTagName('status')[0].firstChild.nodeValue
这篇关于获取XML的nodeValue使用Javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文