xml文件如下:
<?xml version="1.0" encoding="utf-8" ?>
<books>
<book title="藏地密码" imageurl="http://www.iwms.net/buy/pic/product_6.gif">
<description>
这里是概况(www.huyang8.com)
</description>
</book>
<book title="剑桥雅思6" imageurl="http://www.iwms.net/buy/pic/product_6.gif">
<description>
这里是概况(www.huyang8.com)
</description>
</book>
<book title="Professional ASP.NET" imageurl="http://www.iwms.net/buy/pic/product_6.gif">
<description>
这里是概况(www.huyang8.com)
</description>
</book>
</books>
页面如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$.get('novel.xml', function(d){
$('body').append('<h1> Saturn给你推荐几本书: </h1>');
$('body').append('<dl />');
$(d).find('book').each(function(){
var $book = $(this);
var title = $book.attr("title");
var description = $book.find('description').text();
var imageurl = $book.attr('imageurl');
var html = '<dt> <img alt="" src="' + imageurl + '" /> </dt>';
html += '<dd> <span alt="Loading" />';
html += '<p>' + title + '</p>';
html += '<p>' + description + '</p>' ;
html += '</dd>';
$('dl').append($(html));
}); //each
}); //get
}); //ready
</script>
<title></title>
</head>
<body></body>
</html>
效果如下:
Saturn给你推荐几本书:
�ص�����
�����Ǹſ�(www.huyang8.com)
������˼6
�����Ǹſ�(www.huyang8.com)
Professional ASP.NET
�����Ǹſ�(www.huyang8.com)
<?xml version="1.0" encoding="utf-8" ?>
<books>
<book title="藏地密码" imageurl="http://www.iwms.net/buy/pic/product_6.gif">
<description>
这里是概况(www.huyang8.com)
</description>
</book>
<book title="剑桥雅思6" imageurl="http://www.iwms.net/buy/pic/product_6.gif">
<description>
这里是概况(www.huyang8.com)
</description>
</book>
<book title="Professional ASP.NET" imageurl="http://www.iwms.net/buy/pic/product_6.gif">
<description>
这里是概况(www.huyang8.com)
</description>
</book>
</books>
页面如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$.get('novel.xml', function(d){
$('body').append('<h1> Saturn给你推荐几本书: </h1>');
$('body').append('<dl />');
$(d).find('book').each(function(){
var $book = $(this);
var title = $book.attr("title");
var description = $book.find('description').text();
var imageurl = $book.attr('imageurl');
var html = '<dt> <img alt="" src="' + imageurl + '" /> </dt>';
html += '<dd> <span alt="Loading" />';
html += '<p>' + title + '</p>';
html += '<p>' + description + '</p>' ;
html += '</dd>';
$('dl').append($(html));
}); //each
}); //get
}); //ready
</script>
<title></title>
</head>
<body></body>
</html>
效果如下:
Saturn给你推荐几本书:
�ص�����
�����Ǹſ�(www.huyang8.com)
������˼6
�����Ǹſ�(www.huyang8.com)
Professional ASP.NET
�����Ǹſ�(www.huyang8.com)