AJAX XML 实例(w3school)
来源:互联网 发布:mac 刷机iphone 编辑:程序博客网 时间:2024/06/07 16:31
<html><head><script type="text/javascript">function loadXMLDoc(url){var xmlhttp;var txt,x,xx,i;if (window.XMLHttpRequest)//判断浏览器 {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); }else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }xmlhttp.onreadystatechange=function()//onreadystatechange在async=true(异步)的情况下使用 { if (xmlhttp.readyState==4 && xmlhttp.status==200) { txt="<table border='1'><tr><th>Title</th><th>Artist</th></tr>"; x=xmlhttp.responseXML.documentElement.getElementsByTagName("CD"); for (i=0;i<x.length;i++) { txt=txt + "<tr>"; xx=x[i].getElementsByTagName("TITLE"); { try { txt=txt + "<td>" + xx[0].firstChild.nodeValue + "</td>"; } catch (er) { txt=txt + "<td> </td>"; } } xx=x[i].getElementsByTagName("ARTIST"); { try { txt=txt + "<td>" + xx[0].firstChild.nodeValue + "</td>"; } catch (er) { txt=txt + "<td> </td>"; } } txt=txt + "</tr>"; } txt=txt + "</table>"; document.getElementById('txtCDInfo').innerHTML=txt; } }xmlhttp.open("GET",url,true);xmlhttp.send();}</script></head><body><div id="txtCDInfo"><button onclick="loadXMLDoc('/example/xmle/cd_catalog.xml')">获得 CD 信息</button></div></body></html>
http://www.w3school.com.cn/ajax/ajax_xmlfile.asp
1 0
- AJAX XML 实例(w3school)
- Ajax(来自w3school)
- xml(摘自w3school)
- AJAX基础总结(参考w3school)
- Ajax -- W3School 学习笔记
- Ajax W3School学习总结
- w3school HTML DOM实例
- 《w3school-XML》学习小结
- jquery ajax xml 实例
- query ajax xml 实例
- AJAX-XML实例
- AJAX XML 实例
- AJAX XML 实例
- AJAX XML 实例
- XML(w3school)学习总结和摘要1
- AJAX学习总结---来自W3School
- w3school学习9-jQuery 实例
- JS w3school 实例验证 笔记
- mysql 常用查询
- tomcat安装配置
- Iframe高度自适应(兼容IE/Firefox、同域/跨域)
- AOPR弹出Order Now窗口是什么意思
- php.ini常用配置
- AJAX XML 实例(w3school)
- 开源推荐系统Crab安装
- apache+php环境,时遇到php5ts.dll错误
- python学习笔记
- ListView里面嵌套spinner和editext
- 线性表
- MySQL5.7.11免安装版的安装和配置以及解决MYSQL服务无法启动问题
- Mediator模式详解--设计模式(18)
- apache 开启 url_rewrite