国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > WEB開發 > 正文

如何把 XML 文件顯示為 HTML 表格

2024-04-27 15:19:28
字體:
來源:轉載
供稿:網友

<html><head><script type="text/javascript">var xmlhttp;

function loadXMLDoc(url){xmlhttp=null;if (window.XMLHttPRequest){// code for IE7, Firefox, Mozilla, etc.xmlhttp=new XMLHttpRequest();}else if (window.ActiveXObject){// code for IE5, IE6xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}if (xmlhttp!=null){xmlhttp.onreadystatechange=onResponse;xmlhttp.open("GET",url,true);xmlhttp.send(null);}else{alert("Your browser does not support XMLHTTP.");}}

function onResponse(){if(xmlhttp.readyState!=4) return;if(xmlhttp.status!=200){alert("Problem retrieving XML data");return;}

txt="<table border='1'>";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('copy').innerHTML=txt;}

</script></head>

<body><div id="copy"><button onclick="loadXMLDoc('/example/xmle/cd_catalog.xml')">Get CD info</button></div></body></html>

<!--該代碼片段來自于: http://www.sharejs.com/codes/html/9064-->

如何把 XML 文件顯示為 HTML 表格

http://www.sharejs.com/codes/html/9064

<html><head><script type="text/Javascript">var xmlhttp;

function loadXMLDoc(url){xmlhttp=null;if (window.XMLHttpRequest){// code for IE7, Firefox, Mozilla, etc.xmlhttp=new XMLHttpRequest();}else if (window.ActiveXObject){// code for IE5, IE6xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}if (xmlhttp!=null){xmlhttp.onreadystatechange=onResponse;xmlhttp.open("GET",url,true);xmlhttp.send(null);}else{alert("Your browser does not support XMLHTTP.");}}

function onResponse(){if(xmlhttp.readyState!=4) return;if(xmlhttp.status!=200){alert("Problem retrieving XML data");return;}

txt="<table border='1'>";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('copy').innerHTML=txt;}

</script></head>

<body><div id="copy"><button onclick="loadXMLDoc('/example/xmle/cd_catalog.xml')">Get CD info</button></div></body></html>

<!--該代碼片段來自于: http://www.sharejs.com/codes/html/9064-->

如何把 XML 文件顯示為 HTML 表格

http://www.sharejs.com/codes/html/9064


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 乐东| 土默特右旗| 平乐县| 太湖县| 无为县| 安乡县| 辽中县| 济源市| 荃湾区| 花莲县| 偏关县| 贵德县| 五常市| 凭祥市| 仁化县| 望城县| 贵溪市| 广灵县| 隆子县| 江油市| 宿州市| 大埔县| 资阳市| 天台县| 会泽县| 龙井市| 黄陵县| 隆尧县| 休宁县| 安陆市| 武隆县| 镇远县| 安西县| 大理市| 东源县| 惠来县| 梁平县| 怀化市| 鲁甸县| 永城市| 简阳市|