I'm trying to parse an XML document returned from an AJAX call to a PHP script I've written. In Chrome, this works:
xmlDoc.getEle开发者_JAVA百科mentsByTagName("line")[0].attributes.getNamedItem("pdfWidth").value
where
xmlDocis an object created from
parser.parseFromString(xmlhttp.responseText,"text/xml");
In IE,
xmlDocis created by:
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.loadXML(xmlhttp.responseText);
However the above 'getElementsByTagName' returns undefined. Not sure what I'm doing wrong here, can anyone assist?
Edit - think I've sussed it, but I can't answer my own question apparently..
I think I may have sussed this - the following seems to worK:
xmlDoc.getElementsByTagName("line").item(0).getAttribute("pdfWidth");
Took me an hour that, grrrr IE!
I think I may have sussed this - the following seems to worK:
xmlDoc.getElementsByTagName("line").item(0).getAttribute("pdfWidth");
Took me an hour that, grrrr IE!
精彩评论