asp分頁生成html的程序腳本代碼
更新時間:2007年09月22日 22:19:37 作者:
這是asp分頁列表生成靜態(tài)頁面得asp小程序腳本
<!--#include file="conn.asp"-->
<html><head><TITLE>分頁測試</TITLE><LINK href="inc/style.css" type=text/css rel=stylesheet></head>
<%strHead=strHead&"<html>"
strHead=strHead&"<head>"
strHead=strHead&"<TITLE>分頁測試</TITLE>"
strHead=strHead&"<LINK href=""inc/style.css"" type=text/css rel=stylesheet>"
strHead=strHead&"</head>"
%>
<%
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>"
%><%
'分頁部分
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 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
'創(chuàng)建文件系統(tǒng)對象
Set fso=Server.createObject("Scripting.FileSystemObject")
Set f=fso.createTextFile(Server.MapPath("list_"&j&".html"),true)
'寫入網(wǎng)頁內(nèi)容
f.WriteLine strHead&str0&ref
f.close
response.write "正在生成第"&j&"個頁面!<br>"
%><%
next%>
復(fù)制代碼 代碼如下:
<!--#include file="conn.asp"-->
<html><head><TITLE>分頁測試</TITLE><LINK href="inc/style.css" type=text/css rel=stylesheet></head>
<%strHead=strHead&"<html>"
strHead=strHead&"<head>"
strHead=strHead&"<TITLE>分頁測試</TITLE>"
strHead=strHead&"<LINK href=""inc/style.css"" type=text/css rel=stylesheet>"
strHead=strHead&"</head>"
%>
<%
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>"
%><%
'分頁部分
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 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
'創(chuàng)建文件系統(tǒng)對象
Set fso=Server.createObject("Scripting.FileSystemObject")
Set f=fso.createTextFile(Server.MapPath("list_"&j&".html"),true)
'寫入網(wǎng)頁內(nèi)容
f.WriteLine strHead&str0&ref
f.close
response.write "正在生成第"&j&"個頁面!<br>"
%><%
next%>
您可能感興趣的文章:
- IIS6 中"ASP 0201 錯誤 無效的默認腳本語言" 的解決方法
- 使用ASP控制指定站點解析腳本語言函數(shù)
- 用InstallShield打包ASP程序的腳本
- 隱藏修改文件時間和文件屬性的ASP腳本
- ASP.NET調(diào)用javascript腳本的常見方法小結(jié)
- 從一個網(wǎng)站扒下的asp生成靜態(tài)頁面的代碼 腳本之家特供版
- iis、apache與nginx禁止目錄執(zhí)行asp、php腳本的實現(xiàn)方法
- ASP上傳漏洞之利用CHR(0)繞過擴展名檢測腳本
- ASP中Server.Execute和Execute實現(xiàn)動態(tài)包含(include)腳本的區(qū)別
- ASP.NET中后臺注冊js腳本使用的方法對比
- ASP程序中常用的腳本語言
相關(guān)文章
ASP網(wǎng)站生成靜態(tài)html頁面技術(shù)小結(jié)
ASP網(wǎng)站生成靜態(tài)html頁面技術(shù)小結(jié)...2007-07-07asp中利用CSW中文分詞組件來實現(xiàn)自己網(wǎng)站的內(nèi)容關(guān)鍵詞自動提取
asp中利用CSW中文分詞組件來實現(xiàn)自己網(wǎng)站的內(nèi)容關(guān)鍵詞自動提取...2007-03-03asp中判斷服務(wù)器是否安裝了某種組件的函數(shù)
檢查是否存在系統(tǒng)組件或組件是否安裝成功,方便繼續(xù)的操作。給用戶更好的信息指示。2010-12-12