Aquí hay un tutorial detallado sobre funciones de paginación comúnmente utilizadas ASP. El método es muy simple. Amigos interesados, ¡aprendamos al respecto con el editor!
La copia del código es la siguiente:
Rs.opensql, Conn, 1,1
ifrs.eofandrs.bofthen
Respuesta. Escribe "
"
demás
Totalput = Rs.RecordCount
mapperpage = 18
IfcurrentPage
CurrentPage = 1
endif
if (currentPage-1)*maxperPage> totalputThen
if (TotalputModMaxperPage) = 0then
CurrentPage = Totalput/MaxPerPage
demás
CurrentPage = totalput/maxperPage+1
endif
endif
ifcurrentPage = 1
showpage1totalput, maxperpage, "infotype.asp? id =" & request ("id")
showcontent ()
showPageTotalput, maxperPage, "infotype.asp? id =" & request ("id")
demás
if (currentPage-1)*maxperPage
Rs.Move (CurrentPage-1)*MaxperPage
dimbookmark
Marcador = Rs.Bookmark
showpage1totalput, maxperpage, "infotype.asp? id =" & request ("id")
exhibición
showPageTotalput, maxperPage, "infotype.asp? id =" & request ("id")
demás
CurrentPage = 1
showpage1totalput, maxperpage, "infotype.asp? id =" & request ("id")
exhibición
showPageTotalput, maxperPage, "infotype.asp? id =" & request ("id")
endif
endif
endif
%>
subshowcontent ()
%>
IDENTIFICACIÓN
elegir
Título de información
Fecha de actualización
Hacer clic
Agregar gente
editar
borrar
Generar [cero]
i = 1
dowhilenotrs.eof
%>
">
"Target =" _ en blanco "> []
strcounts = truelen (thetitle1)
respuesta.writetetitle1
%>
datetime = RS ("DateTime")
yname = año (DateTime)
Mname = mes (DateTime)
Iflen (mname)
dname = mes (dateTime)
Iflen (DName)
folderName = yname & mname
%>
/.htm"title="view generó la página estática "Target =" _ Blank ">
"> Modificar
) "> Eliminar
) "> Generate (',' ',' Width = 0, Height = 0 ')">)
i = i+1
ifi> maxperpagetheneExitdo
Rs.Movenext
bucle
%>
IDENTIFICACIÓN
elegir
Título de información
Fecha de actualización
Hacer clic
Agregar gente
editar
borrar
generar
Endsub
%>
functionShowPage (TotalNumber, MaxperPage, nombre de archivo)
%>
diminuto
iftotalnumberModmaxperPage = 0then
n = TotalNumber/MaxPerPage
demás
n = TotalNumber/MaxperPage+1
endif
%>
Hay / elementos en total,
Página actual/
[Inicio] [Página anterior]
"> [Inicio] & Page ="> [Página anterior]
[Página siguiente] [Última página] & Page = "> [Página siguiente] & Page ="> [Última página]
Ir a:
onchange = "ubicación.href = this.options [this.selectedIndex] .Value">
ifcurrentPage = jthen
%> & page = "seleccionado>
demás
%>
& Page = ">
endif
próximo
%>
Función final
%>
functionShowPage1 (TotalNumber, MaxperPage, nombre de archivo)
%>
dimb
iftotalnumberModmaxperPage = 0then
b = TotalNumber/MaxPerPage
demás
B = TotalNumber/MaxPerPage+1
endif
%>
Hay / elementos en total,
Página actual/
dxystart = currentPage-5
ifdxystart
dxyend = currentPage+5
ifdxyend> bthendxyend = b
fordxy = dxystarttodxyend
IFDXY = CurrentPagethen
Response.write "[" & "" & dxy & "" & "]" & "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " = rojo>
demás
Response.write "[" & dxy & "" & "]" & "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "
endif
próximo
%>
Función final
%>
rs.
SETRS = nada
Conn.clar
setConn = nada
%>
Lo anterior es un tutorial detallado sobre las funciones de paginación ASP. Creo que lo has aprendido. Para obtener más contenido relacionado, continúe prestando atención al canal de tecnología Wonew.