Voici un tutoriel détaillé sur les fonctions de pagination couramment utilisés ASP. La méthode est très simple. Amis intéressés, apprenons-le avec l'éditeur!
La copie de code est la suivante:
Rs.OpenSQL, Conn, 1,1
ifrs.eofandrs.bofthen
réponse.WRITE "
"
autre
Totalput = Rs.RecordCount
MAPTERPAGE = 18
ifcurrentpage
currentpage = 1
endire
if (currentPage-1) * maxperpage> totalputThen
if (totalputModMaxPerpage) = 0Then
CurrentPage = Totalput / MaxPerpage
autre
CurrentPage = Totalput / MaxPerpage + 1
endire
endire
ifcurrentPage = 1Then
showpage1totalput, maxperpage, "infotype.asp? id =" & request ("id")
showContent ()
showPagetotalput, maxperpage, "infotype.asp? id =" & request ("id")
autre
if (currentPage-1) * maxperpage
Rs.Move (CurrentPage-1) * MaxPerpage
tabac
Bookmark = Rs.Bookmark
showpage1totalput, maxperpage, "infotype.asp? id =" & request ("id")
vitrine
showPagetotalput, maxperpage, "infotype.asp? id =" & request ("id")
autre
currentpage = 1
showpage1totalput, maxperpage, "infotype.asp? id =" & request ("id")
vitrine
showPagetotalput, maxperpage, "infotype.asp? id =" & request ("id")
endire
endire
endire
%>
SubshowContent ()
%>
IDENTIFIANT
choisir
Titre d'information
Date de mise à jour
Faire un clic
Ajouter des personnes
modifier
supprimer
Générer [zéro]
i = 1
dowhilenotrs.eof
%>
">
"Target =" _ Blank "> []
strCounts = truelen (thetitle1)
réponse.WriteTheTitle1
%>
DateTime = Rs ("DateTime")
yname = année (datetime)
mname = mois (datetime)
iflen (mname)
dname = mois (datetime)
iflen (dname)
Foldername = yname & mname
%>
/.htm"title="View page statique générée "cible =" _ blanc ">
"> Modifier
) "> Supprimer
) "> Générer (',' ',' width = 0, height = 0 ')">)
i = i + 1
ifi> maxperpagetheneexitdo
Rs.MovEnext
boucle
%>
IDENTIFIANT
choisir
Titre d'information
Date de mise à jour
Faire un clic
Ajouter des personnes
modifier
supprimer
générer
fin
%>
FunctionShowPage (TotalNumber, MaxPerpage, Nom de fichier)
%>
baisser
iftotalNumberModMaxPerpage = 0THEN
n = TotalNumber / MaxPerpage
autre
n = TotalNumber / MaxPerpage + 1
endire
%>
Il y a / des articles au total,
Page actuelle /
[Accueil] [Page précédente]
"> [Home] & page ="> [page précédente]
[Page suivante] [Dernière page] & page = "> [page suivante] & page ="> [Dernière page]
Aller à:
onchange = "location.href = this.options [this.selectedIndex] .Value">
ifcurrentPage = jthen
%> & page = "sélectionné>
autre
%>
& page = ">
endire
suivant
%>
finition de fin
%>
FunctionShowPage1 (TotalNumber, MaxPerpage, Nom de fichier)
%>
diban
iftotalNumberModMaxPerpage = 0THEN
b = TotalNumber / MaxPerpage
autre
b = TotalNumber / MaxPerpage + 1
endire
%>
Il y a / des articles au total,
Page actuelle /
dxystart = currentPage-5
ifdxystart
dxyend = currentpage + 5
ifdxyend> bthendxyend = b
FORDXY = DXYSTARTTODXYEND
ifdxy = currentpagethen
réponse.write "[" & "" & dxy & "" & "]" & "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " = rouge>
autre
réponse.write "[" & dxy & "" & "]" & "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "
endire
suivant
%>
finition de fin
%>
Rs.Close
setrs = rien
Conn.Close
setConn = rien
%>
Ce qui précède est un tutoriel détaillé sur les fonctions de pagination ASP. Je crois que vous en avez appris. Pour plus de contenu lié, veuillez continuer à prêter attention au canal technologique Wonew.