jameflowersam
New Member
I'm trying to display all the nodes of an specific tag, so far it does filter the data I want but only one node showsup. Can somebody help me please?Here's the XML:\[code\]<?xml version="1.0" encoding="UTF-8"?><USA><NY> <Cell>NY Store 1</Cell> <Cell>NY Store 2</Cell> <Cell>NY Store 3</Cell></NY><CA> <Cell>CA Store 1</Cell> <Cell>CA Store 2</Cell> <Cell>CA Store 3</Cell> </CA></USA>\[/code\]Here's the Script:\[code\]<script>function loadXMLDoc(){ var xmlhttp; var txt,x,i; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { xmlDoc=xmlhttp.responseXML; txt=""; x=xmlDoc.getElementsByTagName("CA"); for (i=0;i<x.length;i++) { xx=x.getElementsByTagName("Cell"); } try { txt=txt + xx[0].childNodes[0].nodeValue + "<br />"; } catch (er) { } document.getElementById("result").innerHTML=txt; } } xmlhttp.open("GET","stores.xml",true); xmlhttp.send();}</script>\[/code\]and here's the HTML:\[code\]<button type="button" onclick="loadXMLDoc()">California</button><div id="result">Please select your state</div>\[/code\]As I said, it words fine, but its only showing one element under California. Any ideas? Thanks in advanced!