I have a function that calls an xml page, selects elements by tag names, and I'm trying to call a specific one back. code so far:
var xmlDoc = loadXMLDoc("test.xml");
var x = xmlDoc.getElementsByTagName("tagname");
var PittWins = x.item(2);
This will return the [object element]
var xmlDoc = loadXMLDoc("test.xml");
var x = xmlDoc.getElementsByTagName("tagname");
var PittWins = x[2].data;
The above code gives me undefined.
var xmlDoc = loadXMLDoc("nhl.xml");
var x = xmlDoc.getElementsByTagName("tagname");
var PittWins = x.length;
when entered above, I get the correct result.
I am trying to understand why it gives me the length and not the specific node ..
Shawn source
share