Practical tips for XML volumes (3): Dynamic paging

Source: Internet
Author: User
Motivation: dynamic paging is used to facilitate users to view large volumes of data. Therefore, the paging function is the most widely used and most commonly used function module on the website. The previous pages of information are connected to the database, each time

Motivation: dynamic paging is used to facilitate users to view large volumes of data. Therefore, the paging function is the most widely used and most commonly used function module on the website. In the past, the paging information is connected to the database, and each click must be supported by the background database. This not only increases the server burden, but also seriously affects the user's browsing speed.
Imagine what would happen if we put the paging effect on the client? Look at the design below!

Materials:

Dynamic paging of XML volumes

There are two files: pages. xml and pages. xsl.

Purpose:

Put the paging effect on the client. Filter data without refreshing a new page, effectively improving the efficiency of data browsing.

Code:

Reference content is as follows:

Pages. xml




1
Sailflying
A simple paging
2002-1-11 17:35:33
XML topics


2
Flyingbird
Marry you. it hurts you.
2001-09-06 12:45:51
Essence of water injection


3
Accounts
Use of regular expressions in UBB forum
2001-11-23 21:02:16
Web Programming Essence


4
Taiyilang
End-of-year classic rudder gathering full manual v0.1
2000-12-08 10:22:48
Forum water injection zone


5
Mmkk
Asp error message summary
2001-10-13 16:39:05
Javascript script


 

Pages. xsl





Practical tips for XML volumes (3): Dynamic paging

Script

<br />var OnePageNum=2; <br />var PageNum=1; <br />var XMLPageNum=1; <br />function pages(Num) <br />{ <br />stylesheet=document.XSLDocument; <br />source=document.XMLDocument; <br />nodes=source.documentElement.childNodes; <br />len=nodes.length; <br />for(i=1;i<=(len/OnePageNum);i ); <br />XMLPageNum=i; <br />var firstNum=0; <br />var lastNume=0; </p> <p>if (Num=="first") {PageNum=1;} <br />if (Num=="previous") {if (PageNum>1) PageNum -=1;} <br />if (Num=="next") {if (PageNum<XMLPageNum) PageNum =1;} <br />if (Num=="last") {PageNum =XMLPageNum;} </p> <p>sortField=document.XSLDocument.selectSingleNode("//@expr"); <br />firstNum=OnePageNum*(PageNum-1) 1; <br />lastNum=OnePageNum*(PageNum-1) OnePageNum; <br />text="childnumber(this)>=" firstNum " & childnumber(this)<=" lastNum; <br />sortField.value=text; <br />Layer1.innerHTML=source.documentElement.transformNode(stylesheet); <br />} <br />

Script


Practical tips for XML volumes (3): Dynamic paging







Homepage
Previous Page
Next page
Last page














No. Name Topic Posting time Return class


































Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.