<员工> <姓名>麻花疼</姓名> <性别>男</性别> <年龄>40</年龄> <职位>疼逊CEO</职位> </员工>
<?xml version="1.0" encoding="utf-8" ?> <Persons> <Person FullName="Bill Gates"> <Corporation>Microsoft</Corporation> <Description>The largest software company</Description> <Products>Windows series OS, SQL Server Database, XBox 360...</Products> </Person> <Person FullName="Jobs"> <Corporation>Apple</Corporation> <Description>The famous software company</Description> <Products>Macintosh, iPhone, iPod, iPad...</Products> </Person> <Person FullName="Larry Page"> <Corporation>Google</Corporation> <Description>the largest search engine</Description> <Products>Google search, Google Adsense, Gmail...</Products> </Person> </Persons>
<script type="text/javascript">
jQuery(document).ready(function() {
/* 先用 $.get 方法载入 XML 文件 */
$.get("EmployeesInformation.xml", function(xmlData) {
/* 我们要讲得到的数据放入一个表格里面,这里定义一个表格字符窜 */
var htmlData = "<table border='1'>";
/* 找到 Person 元素,然后用 each 方法进行遍历 */
$(xmlData).find("Person").each(function() {
var Person = $(this); /* 将当前元素复制给 Person */
var FullName = Person.attr("FullName"); /* 获取 Person 的 FullName 属性 */
var Corporation = Person.find("Corporation").text(); /* 获取 Person 中子元素 Corporation 的值 */
var Description = Person.find("Description").text(); /* 获取 Person 中子元素 Description 的值 */
var Products = Person.find("Products").text(); /* 获取 Person 中子元素 Products 的值 */
/* 将得到的数据,放到表格的一行中 */
htmlData += "<tr>";
htmlData += " <td>" + FullName + "</td>";
htmlData += " <td>" + Corporation + "</td>";
htmlData += " <td>" + Description + "</td>";
htmlData += " <td>" + Products + "</td>";
htmlData += "</tr>";
});
//完成表格字符窜
htmlData += "</table>";
//将表格放到 body 中
$("body").append(htmlData);
});
});
</script>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有