Generate html program script code by asp page

Source: Internet
Author: User

This is the asp applet script used to generate static pages in the asp page list. Copy codeThe Code is as follows: <! -- # Include file = "conn. asp" -->
<Html> <% StrHead = strHead & "StrHead = strHead & "StrHead = strHead & "<TITLE> paging 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 while 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>"
%> <%

'Paging part
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 href1_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 10 = 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 webpage content
F. WriteLine strHead & str0 & ref
F. close
Response. write "generating Page No." & j! <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.