Paging control

zhaozj2021-02-16  52

First read the database, and take the query results and assemble

Open the database part ... omit

Set all the information into an array variable

Sum = rs.Recordcount 'The total number of records after the information query

Field = rs.fields.count 'records the number of information after the query

Redim thedata (sum) 'comes a array variable record per profile

Redim Thefield (Field) 'Notice a Array Variable Record of each column

'Export information and write in variables

For J = 0 to Sum -1

For i = 0 to Field-1 'Get all field materials

Thefield (i) = rs.fields (i) .value

NEXT

TheData (j) = Thefield 'All field data is written in a record

Rs.Movenext 'Remove a data

NEXT

Set paging

PageSize = 10 'set the maximum number per page

INGPAGE = 0 'Setting the start page (the page number starts by 0, "the flowchart is starting from 1)

Function PageSet () When the page is read, it will begin execution.

{

Total number of pages

PageCount = <% = PageCount%>

Take the page number now to display

INGPAGE = <% = ingpage%>

Use the back ring to generate all the page numbers and decide whether to display

For (i = 0; i

{

IF (i == ingpage)

{

THEDATAPAGE [I] .style.visibility = "visible";

Document.Thepage.NowPage.Value = i 1;

}

Else

{

THEDATAPAGE [I] .style.visibility = "hidden";

}

}

}

Function PageChange (Pagenumber)

{

Use the round circle to reach the switch to the page display

For (i = 0; i

{

IF (i == PAGENUMBER)

{

THEDATAPAGE [I] .style.visibility = "visible";

Document.Thepage.NowPage.Value = i 1;

}

Else

{

THEDATAPAGE [I] .style.visibility = "hidden";

}

}

}

Function Pageup ()

{

Calculate the page number of the previous page and perform the function to pass the result to the page switching.

PageCount = <% = PageCount%>

INGPAGE = <% = ingpage%>

Pagenumber = thepage.nowpage.value -2

IF (PAGENUMBER <0)

{

Pagenumber = 0

}

PageChange (PAGENUMBER)

}

Function PageDown ()

{

Calculate the page number of the next page and perform the function to pass the result to the page switching.

PageCount = <% = int (pagecount)%>

INGPAGE = <% = ingpage%>

Pagenumber = thepage.nowpage.value

IF (Pagenumber> = PageCount)

{

Pagenumber = PageCount -1

}

PageChange (PAGENUMBER)

}

The display interface first creates a list name part of the form header

Code

Name1

Name2

Name3

Use the double loop to get all pre-stored database materials, and classify

<%

For J = 0 to Sum -1

IF J Mod PageSize = 0 THEN

Response.write "

Response.write "

"

END IF

Response.write "

"

For i = 0 TO Field-1

Response.write "

" & TRIM (THEDATA (J) (i)) & ""

NEXT

Response.write ""

IF J Mod PageSize = Pagesize-1 or J = SUM-1 THEN

Response.write ""

Response.write ""

END IF

NEXT

%>

Establish all function keys

And with labeling mode, use Left, TOP settings to adjust the displayed position

<% for i = 0 to pagecount-1%>

<% = int (i) 1%>

<% next%>


Currently in the "INPUT TYPE =" TEXT "name =" nowpage "size =" 2 "maxlength =" 2 "r" page / total "name =" pagecount "value =" PageCount "value =" <% = PageCount %> "SIZE =" 2 "maxlength =" 2 "readonly> page

转载请注明原文地址:https://www.9cbs.com/read-22933.html

New Post(0)
CopyRight © 2020 All Rights Reserved
Processed: 0.034, SQL: 9