Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/394.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用javascript访问特定节点下的xml节点? 约翰 test@test.com 一些文本 1. 自动测试系统 some@test.ee 伟大的网站! 0_Javascript_Jquery_Xml - Fatal编程技术网

如何使用javascript访问特定节点下的xml节点? 约翰 test@test.com 一些文本 1. 自动测试系统 some@test.ee 伟大的网站! 0

如何使用javascript访问特定节点下的xml节点? 约翰 test@test.com 一些文本 1. 自动测试系统 some@test.ee 伟大的网站! 0,javascript,jquery,xml,Javascript,Jquery,Xml,您好,我正在尝试使用Javascript访问xml节点。有谁能解释一下如何访问该证明下的所有节点(id='4c050652f0c3e') 谢谢。在jquery中使用选择器 <testimonials> <testimonial id="4c050652f0c3e"> <nimi>John</nimi> <email>test@test.com</email> <text>Some text

您好,我正在尝试使用Javascript访问xml节点。有谁能解释一下如何访问该证明下的所有节点(id='4c050652f0c3e')

谢谢。

在jquery中使用选择器

<testimonials>
<testimonial id="4c050652f0c3e">
    <nimi>John</nimi>
    <email>test@test.com</email>
    <text>Some text</text>
    <active>1</active>
    </testimonial>
<testimonial id="4c05085e1cd4f">
    <name>ats</name>
    <email>some@test.ee</email>
    <text>Great site!</text>
    <active>0</akctive>
</testimonial>   </testimonials>

那么你必须使用直接id

$("[category=cooking]").children().each(function(){
alert($(this).text());
});

谢谢,这很有效。你能用Javascript给我解释一下吗?谢谢你的帮助。@user3891074 Javascript和jquery相比有点复杂,jquery支持所有的现代浏览器,而且我也不完全了解Javascript,使用jquery是最好的
 $("#4c050652f0c3e").children().each(function () {
    alert($(this).text());
});