is there a .innerXML?
is there a .innerXML?
我想问一下这里是否有熟悉wif-xml的人可以给我一些帮助。。。http://www.plognow.com/xml/login.xml我有一个小函数,用来分解它。。。
function dialogXML(varName,url){
if (window.XMLHttpRequest){
r[varName]=new XMLHttpRequest();
}else{
r[varName]=new ActiveXObject("Microsoft.XMLHTTP");
}
r[varName].onreadystatechange=function(){
if (r[varName].readyState==4 && r[varName].status==200){
var rep=r[varName].responseXML.getElementsByTagName('box')[0];
var title=rep.getElementsByTagName('title')[0].nodeValue;
var content=rep.getElementsByTagName('content')[0].nodeValue;
createDialog(title,content);
}
}
r[varName].open('GET',url,true);
r[varName].send();
}
我不确定XMLDOM是如何工作的,但我可以检索一个标记的内部吗?(所有子代的子代等),就像您在innerHTML中所做的那样。谢谢
您可以使用jQuery来操作XML文档,而不仅仅是HTML文档。HTML文档是XML文档。
if (r[varName].readyState==4 && r[varName].status==200){
var xml = r[varName].responseXML;
var rep = $("box:first", xml);
var title = $("title:first", rep).text();
var content= $("content:first", rep).text();
createDialog(title, content);
}
如果您的问题是如何检索xml树结构,那么答案是:使用r[varName]
的responseXML
属性。
相关文章:
- Is there a wrapper/grouping element usable in <head>?
- Scala + Play + Akka. Is there a need for Backbone.js?
- Is there a interpretation difference between "..."
- There is no phonegap.js
- 如何在JavaScript和FireFox中获取innerXml或outerXml
- Is there any security risk using <noscript>?
- is there a .innerXML?
- Is there any difference between (cond && value || de
- Is there an npm for oauth?
- NPM Error: Cannot find module 'are-we-there-yet'
- Is there a Money class for JavaScript?
- Is there any last() in YUI NodeList?
- don't work 'fadeOut' If there is 'replaceWit
- is there an iTunes javascript api
- 用Javascript调试Spotify应用程序——there'这一定是更好的方法