<% '************************************* **************************************** *********
'**
'* File Description *
'**
'*************************************** **************************************** *********
'Timeout '----------------------------------------------------------------------------------------
'Functions implemented in this file:
'Getpage (max) gets the page number. Return type: int
'Showpage (intcurpage, intpagecount, intpagesize, intrecordcount) display navigation bar, no return value
'Timeout '----------------------------------------------------------------------------------------
'Use instance: place the Code in the following * to the body in the ASP file.
'Timeout '----------------------------------------------------------------------------------------
'* <Form action = ''method = 'get' name = 'frmpage'>
'* <%
'* Intpagesize = 5' page size: Rs. pagesize
'* Intpagecount = 6' page count: Rs. pagecount
'* Intrecordcount = 29' total number of records: Rs. recordcount
'* Intcurpage = getpage (intpagecount)' gets the current page: Rs. absolutepage
'* Call showpage (intcurpage, intpagecount, intpagesize, intrecordcount)' displays the navigation bar
'* %>
'</Form>
'Timeout '----------------------------------------------------------------------------------------
'*************************************** **************************************** *********
'**
'* Function implementation part *
'**
'*************************************** **************************************** *********
%>
<Script language = "JavaScript">
Function viewpage (ipage ){
Document. frmpage. m_page.value = ipage;
Document. frmpage. Submit ();
}
</SCRIPT>
<%
'Timeout '----------------------------------------------------------------------------------------
'Function name: getpage (maxpagenum)
'Function: Get m_page and convert it to the correct int Type page number.
'Parameter list: Max maximum restricted page number, for example, Rs. pagesize
Program Design: Yan Yulu qylmail@163.com
'Design Date: 2006-9-20
'Timeout '----------------------------------------------------------------------------------------
Function getpage (max)
Page = request ("m_page ")
If page = "" then
Page = 1
Elseif not isnumeric (PAGE) then
Page = 1
Else
Page = CINT (page)
End if
If page <1 then
Page = 1
End if
If page> MAX then
Page = max
End if
Getpage = page
End Function
'Timeout '----------------------------------------------------------------------------------------
'Function name: showpage (p_current, p_total, p_pagesize, r_total)
'Function: display the pagination navigation bar
'Parameter list:
'P_total: Total number of pages
'P_current: Current page
'P_pagesize: number of records per page
'R_total: Total number of records
Program Design: Yan Yulu qylmail@163.com
'Design Date: 2006-9-20
'Call method:
'Include the Page code to the page to be called. Add a form named "frmpage,
'Call showpage (p_current, p_total, p_pagesize, r_total) in the form ).
'Other parameters to be passed can be passed in this form: <input name = "keys" type = "hidden" id = "keys" value = "1">
'Example:
'<Form action = "" method = "get" name = "frmpage">
'<Input name = "keys" type = "hidden" id = "keys" value = "1">
'<% Call showpage (p_current, p_total, p_pagesize, r_total) %>
'</Form>
'Backup note:
'To facilitate the addition of other parameters, this function does not provide a form,
'So you need to put it in a form and name the form as frmpage.
'Timeout '------------------------------------------------------------------------------------------
Sub showpage (p_current, p_total, p_pagesize, r_total)
Response. Write "Total <font color = '# ff0000'>" & r_total & "</font> records"
Response. write "Page Times <font color = '# ff0000'>" & p_current & "</font>/<font color = '# ff0000'>" & p_total & "</font >"
Response. Write "<font color = '# ff0000'>" & p_pagesize & "</font>"
If p_total> 1 then 'when the record is greater than one page
If p_current = 1 then 'the current record is the first page
Response. Write "homepage <a href = 'javascript: viewpage (" & p_current + 1 & ") '> next page </a>"
Response. Write "<a href = 'javascript: viewpage (" & p_total & ") '> last page </a>"
Elseif p_current = p_total then 'the current record is the last page
Response. Write "<a href = 'javascript: viewpage (1) '> homepage </a>"
Response. Write "<a href = 'javascript: viewpage (" & p_Current-1 & ") '> previous page </a> next page"
Else
Response. write "<a href = 'javascript: viewpage (1) '> Home </a> <a href = 'javascript: viewpage (" & p_Current-1 &") '> previous page </a>"
Response. write "<a href = 'javascript: viewpage (" & p_current + 1 & ") '> next page </a> <a href = 'javascript: viewpage ("& p_total &") '> last page </a>"
End if
Else' when the record has only one page
Response. Write "last and next pages on the home page"
End if
Response. write "<input name ='m _ page' type = 'text' size = '3' maxlength = '5' value = '" & p_current & "'onmouseover = 'this. focus (); this. select () '/>"
Response. Write "<input name = 'btngo' type = 'submit 'value = 'Go'/>"
End sub
%>