jquery.pagination控件对xml数据分页(急)
admin 发表于 2010-08-28 | 来源:互联网 | 阅读:

数据列表已经输出了,但把数据添加到分页控件里去失败,高手们指点。。。。

JScript code
<script type="text/javascript"> $(function() { InitData(0); var num_entries = "", tbody = ""; function InitData(pageindx) { $.ajax({ dataType: "xml", url: "templates.xml", success: function(xml) { $(xml).find("item").each(function() { num_entries = $(xml).find("item").size(); var newsid = "", newstitle = "", url = "", time = "", sort = ""; newsid = $(this).attr("newsid"); newstitle = $(this).attr("newstitle"); url = $(this).attr("url"); time = $(this).attr("auditortime"); sort = $(this).attr("newssort"); var trs = ""; trs += "<tr><td><a href=http://topic.csdn.net/u/html/news_nr.aspx?id=" + newsid + "&type=" + newstitle + " target=_black>" + sort + "</a></td><td>" + url + "</td><td>" + time + "</td></tr>"; tbody += trs; }); //alert(num_entries); $("#markTable").append(tbody); $("#Pagination").pagination(num_entries, { num_edge_entries: 1, num_display_entries: 12, callback: pageselectCallback, items_per_page: 20 //每页显示1项 }); // function pageselectCallback(page_index, jq) { // InitData(page_index); // } } }); } }); function pageselectCallback(page_index, jq) { InitData(page_index); } </script>

XML code
<?xml version="1.0" encoding="utf-8"?> <neng> <item newsid="32172" newstitle="insert新闻测试" url="32172.html" AUDITORTIME="2010-8-17 17:37:56" /> <item newsid="32173" newstitle="〖金属市场〗冠华期货6月22日基本金属日评" url="32173.html" AUDITORTIME="2010-8-17 17:37:46" /> </neng>
才1个评论
  1. boysee 说:

    …居然有这种控件以前想写手分页写不出来

我要评论

评论功能因故关闭!

请加入我们的QQ群一起参与讨论:群号59400482(500人超级群)


返回首页 | 关于我们 | 联系我们 | 广告合作 | 网站地图 | 友情链接 | 版权声明