使用JavaScript+XML实现分页

类别:.NET开发 点击:0 评论:0 推荐:

代码如下:
<xml id="users"> <userGroup> <user> <userid>user 1</userid> <name>name 1</name> </user> <user> <userid>user 2</userid> <name>name 2</name> </user> <user> <userid>user 3</userid> <name>name 3</name> </user> <user> <userid>user 4</userid> <name>name 4</name> </user> <user> <userid>user 5</userid> <name>name 5</name> </user> <user> <userid>user 6</userid> <name>name 7</name> </user> <user> <userid>user 7</userid> <name>name 7</name> </user> <user> <userid>user 8</userid> <name>name 8</name> </user> <user> <userid>user 9</userid> <name>name 9</name> </user> </userGroup> </xml> <table id="datatable" datasrc="#users" DATAPAGESIZE="3" width="400" border="1"> <tr> <td><span datafld="userid"></span></td> <td><span datafld="name"></span></td> </tr> </table> <button onclick="document.all.datatable.firstPage()">First Page</button> <button onclick="document.all.datatable.previousPage()">Previous Page</button> <button onclick="document.all.datatable.nextPage()">Next Page</button> <button onclick="document.all.datatable.lastPage()">Last Page</button>
[Ctrl+A 全选 提示:你可先修改部分代码,再点运行代码]

本文地址:http://com.8s8s.com/it/it41315.htm