首页 >> Web 开发技术交流
firefox 的responseXML.xml 问题 阅读:11416回复:6
用 XMLHttpRequest 对象的
responseXML.xml 为什么在 ie 里面 可以获取数据 而 firefox 却得到 undefined 呢? var xmldoc = new XMLHttpRequest(); xmldoc.open('GET',src, false); xmldoc.send(''); alert("123"); return xmldoc.responseXML.xml 这么写的 xmldoc.responseText 可以得到数据 xmldoc.responseXML.xml 却不可以 var parser = new DOMParser(); xml = parser.parseFromString(xmldoc.responseXML.xml, "text/xml"); 的方法也试过了 得道的仍然是 undefined 用 XMLSPY检查了 格式也是良好的呀 我的ie是 7.0 的 firefox是2.0 |
是 responseXML 的 .xml方法 啊 用 responseXML.Text的到的也是 undefined
直接用 responseXML 的到的是 Object XMLdocument |
responseXML就是一个对象,其本身没有xml/Text对象或方法,如果想得到Object XMLdocument请使用responseXML,如果想得到text,请使用responseText
|
你可以将responseTest打印出来,而responseXML无法打印,用FF打开相应XUL文件即可看到response的信息。
|