将xml内容输出到div中
来源:互联网 发布:淘宝客服怎么知道业绩 编辑:程序博客网 时间:2024/09/21 09:27
note.xml文件结构:
<nooo><note><to>George</to><from>John</from><heading>Reminder</heading><body>Don't forget the meeting!</body></note><note><to>a</to><from>John</from><heading>Reminder</heading><body>Don't forget the meeting!</body></note><note><to>George</to><from>John</from><heading>Reminder</heading><body>Don't forget the meeting!</body></note></nooo>
利用js将xml输出到div中:
<!DOCTYPE html><html><head><meta charset="utf-8"><title></title><style> .aaaa{width: 30%;height: 50px;line-height: 50px;text-align: center;border: 1px solid darkblue;float: left;}</style></head><body> <div id="xmlid"></div><script>xmltext = new XMLHttpRequest;xmltext.open("GET","note.xml",false);xmltext.send();a = xmltext.responseXML;//document.getElementById("xmlid").innerHTML = a.getElementsByTagName("to")[2].childNodes[0].nodeValue;x = a.getElementsByTagName("note");for(i=0;i<x.length;i++){document.write("<div class='aaaa'>");document.write(x[i].getElementsByTagName("to")[0].childNodes[0].nodeValue);document.write("</div>");document.write("<div class='aaaa'>");document.write(x[i].getElementsByTagName("heading")[0].childNodes[0].nodeValue);document.write("</div>");document.write("<div class='aaaa'>");document.write(x[i].getElementsByTagName("body")[0].childNodes[0].nodeValue);document.write("</div>");}</script></body></html>
1 0
- 将xml内容输出到div中
- TextBox内容输出到XML中
- 将MsFlexGrid控件中显示的内容输出到文本文件
- 将windows控制台内容输出到文件中
- 将MsFlexGrid控件中显示的内容输出到文本文件
- 使用命令将logcat中的内容输出到文本文件中
- 将屏幕上的内容输出到一个文本中
- 使用命令将logcat中的内容输出到文本文件中
- 使用命令将logcat中的内容输出到文本文件中
- 将xml文档内容封装到对象中
- 将另一个进程console输出的内容输出到某内存中去
- 将程序输出在控制台的内容输出到文档中
- 将控件的内容输出到Excel
- C++ 将内容输出到文本
- 在vugen中,如何将参数化内容的当前值输出到调试信息中
- 将数据库中的内容以表格形式显示到页面的div中
- 下拉框事件触发,将返回的内容写到你的页面div中
- 将树输出到XML文件
- 知乎问答:Android 6.0下还需要使用绿色守护么?
- 键码值指南
- Git远程操作详解
- AndroidManifest.xml详细解析
- 自定义View的分类详解
- 将xml内容输出到div中
- android调用webservice
- 如何使背景图片自适应浏览器大小
- Android学习笔记-自定义视图之比例图
- 【MFC中解决滚轮滚动一次的值过大的问题】
- 模糊聚类R语言实现代码
- Nuget,程序员的功能包
- Apache+tomcat7负载均衡集成错误集合
- Budgetvm 搭建vps