ASP paging list generate static page applet script

Source: Internet
Author: User
Tags end file system sql
Programs | pagination | scripts | static | page

<!--#include file= "conn.asp"-->
<%strHead=strHead& "strhead=strhead& "strhead=strhead& "<TITLE> pagination Test </TITLE>"
strhead=strhead& "<link href=" "Inc/style.css" "Type=text/css rel=stylesheet>"
strhead=strhead& "%>
<%
Sql= "SELECT * FROM News"
Set Rs=server.createobject ("ADODB. Recordset ")
Rs.Open sql,conn,1,1
%><%
rs.pagesize=2
Totalpage=rs.pagecount
Rs.close
Set rs=nothing

For J=1 to Totalpage
Sql= "SELECT * FROM News"
Set Rs=server.createobject ("ADODB. Recordset ")
Rs.Open sql,conn,1,1

Whichpage=j
rs.pagesize=2
Totalpage=rs.pagecount
Rs.absolutepage=whichpage
Howmanyrecs=0
%><%
Str0= ""
str0=str0& "</p>"
str0=str0& "<table bgcolor= #cecfce align=center border=0 width=800 cellpadding=2 cellspacing=1>"
%><%
Do, not rs.eof and howmanyrecs<rs.pagesize
%><%
str0=str0& "<tr bgcolor= #f7f7f7 >"
str0=str0& "<td bgcolor= #f7f7f7 align=" "Center" ">" &rs (0) & "</td>"
str0=str0& "<td bgcolor= #f7f7f7 align=" "Center" ">" &rs (1) & "</td>"
str0=str0& "<td bgcolor= #f7f7f7 align=" "Center" ">" &rs (2) & "</td>"
str0=str0& "<td bgcolor= #f7f7f7 align=" "Center" ">" &rs (3) & "</td>"
str0=str0& "</tr>"
%><%
Rs.movenext
Howmanyrecs=howmanyrecs+1
Loop
Rs.close
Set rs=nothing
%><%str0=str0& "</table>"
%><%

' Pagination section
Ref= ""

ref=ref& "<br>"
ref=ref& "<table bgcolor= #cecfce align=center border=0 width=800 cellpadding=0 cellspacing=1>"
ref=ref& "<tr bgcolor= #f7f7f7 >"
ref=ref& "<td>"
ref=ref& "<b>pages:" & J & "/" & Totalpage & "</b>"
ref=ref& "</td>"
ref=ref& "<td>"

ref=ref& "<a href=list_1.html" & ">" & "<font face=webdings>9</font>" & "</a>"
If Whichpage=1 Then
ref=ref& "<font face=webdings>7</font>"
Else
ref=ref& "<a href=list_" &j-1& "html" & ">" & "<font face=webdings>7</font>" & "</a>"
End If

For Counter=1 to Totalpage
ref=ref& "<a href=list_" &counter& ". html" & ">[" & Counter & "]</a>"
ref=ref& ""
If counter mod = 0 Then
ref=ref& "<br>"
End If
Next

if (whichpage>totalpage or whichpage=totalpage) then
ref=ref& "<font face=webdings>8</font>"
Else
ref=ref& "<a href=list_" &j+1& "html" & ">" & "<font face=webdings>8</font>" & "</a>"
End If
ref=ref& "<a href=list_" &totalpage& "html" & ">" & "<font Face=webdings>:</font > "&" </a> "

Dim fso,f
Dim Strtitle,strcontent,strout
' Create a File system object
Set fso=server.createobject ("Scripting.FileSystemObject")
Set F=fso.createtextfile (Server.MapPath ("List_" &j& ". html"), true)

' Write page content
F.writeline Strhead&str0&ref
F.close
Response.Write "Generating &j& page!<br>"
%><%
Next%>



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.