<SCRIPT type = "text/JavaScript">
Function multi (Num, perpage, currpage, mpurl ){
/********** Parameter description *********
The total number of num records provided by the server program.
Perpage records per page
Current page number of currpage
Mpurl page url (for example, list. php)
***************************/
// Calculate the total number of pages
If(Num % perpage = 0 ){
Pages = num/perpage;
}Else{
Pages = math. Floor (Num/perpage) + 1;
}
// Process the paging URL address. When there is a variable parameter, add "&" after it; otherwise, add "?";
// Mpurl = mpurl. Search (/? /)> 0? Mpurl + "&": mpurl + "? ";
If(Mpurl. Search ('/? /')> 0)
{
Mpurl = mpurl + "? ";
}
Else
{
Mpurl = mpurl + "&";
}
Document. Write ('col' + num + 'record ');
If(Currpage = 1 ){
Document. Write ('homepage preput ');
}Else{
// When the current page is not one page, the home page and the previous page are displayed.
Document. Write ('homepage preput ');
}
If(Currpage> = pages ){
Document. Write ('Next last page ');
}Else{
// When the current page is not the last page, the next page and the last page are displayed.
Document. Write ('Next last page ');
}
Document. Write ('page: '+ currpage +'/'+ pages +' page '+ perpage +'/page :');
// Pagination drop-down list for automatic redirect
Document. Write ("");
For(I = 1; I '+ I +' ');
}Else{
Document. Write ('page '+ I + ');
}
}
Document. Write ('');
}
Multi (123, 20, 'p. asp? Id = 1 ')
</SCRIPT>
<Script language = "JavaScript"> multi (123, 20, 'p. asp? Id = 1') </SCRIPT>
To display the paging code, you only need to insert the following statement: Multi (123, 20, 1, 'js_multipage.htm '), when setting specific parameters, you only need to display the relevant variables of your ASP or PHP program here, as shown in PHP: </scriptlanguage = "JavaScript"> multi (<? = $ Total?>, <? = $ Perpage?>, <? = $ Page?> , 'Index. php? Bid = 1' </script