一段生成静态页的代码

作者在 2007-03-29 03:49:00 发布以下内容

<!--#i nclude file="inc/conn.asp"-->
<html><head><TITLE>分页测试</TITLE><LINK href="/blog/inc/style.css" type=text/css rel=stylesheet></head>

<%strHead=strHead&"<html>"
strHead=strHead&"<head>"
strHead=strHead&"<TITLE>分页测试</TITLE>"
strHead=strHead&"<LINK href="/blog/"style.css"" type=text/css rel=stylesheet>"
strHead=strHead&"</head>"
%>
<%
sql="select * from t_task"
set rs=server.createObject("ADODB.Recordset")
rs.open sql,conn,1,1
%>
<%
rs.pagesize=15
totalpage=rs.pagecount
rs.close
set rs=nothing

for j=1 to totalpage
sql="select * from t_task"
set rs=server.createObject("ADODB.Recordset")
rs.open sql,conn,1,1

whichpage=j
rs.pagesize=15
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
%>
<%
path="task/taskview.asp?pid="
str0=str0&"<tr bgcolor=#f7f7f7>"
str0=str0&"<td bgcolor=#f7f7f7 align=""center"">"&rs(0)&"</td>"
str0=str0&"<td bgcolor=#f7f7f7 align=""center"">"&"<a href="& path & rs(0)&">" & rs(1)& "</a>" & "</td>"
str0=str0&"<td bgcolor=#f7f7f7 align=""center"">"&rs(2)&"</td>"
str0=str0&"<td bgcolor=#f7f7f7 align=""center"">"&rs(3)&"</td>"
str0=str0&"<td bgcolor=#f7f7f7 align=""center"">"&rs(4)&"</td>"
str0=str0&"<td bgcolor=#f7f7f7 align=""center"">"&rs(5)&"</td>"
str0=str0&"<td bgcolor=#f7f7f7 align=""center"">"&rs(6)&"</td>"
str0=str0&"<td bgcolor=#f7f7f7 align=""center"">"&rs(7)&"</td>"
str0=str0&"<td bgcolor=#f7f7f7 align=""center"">"&rs(8)&"</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>&nbsp;"
ref=ref&"<b>页面: " & j & " / " & totalpage &"</b>"
ref=ref&"</td>"
ref=ref&"<td>&nbsp;"

ref=ref&"<a href="/blog/list_1.html""&">" & "<FONT face=Webdings>9</FONT>" & "</a>&nbsp;"
   if whichpage=1 then
   ref=ref&"<FONT face=Webdings>7</FONT>"
   else
   ref=ref&"<a href="/blog/list_""&j-1&".html"&">" & "<FONT face=Webdings>7</FONT>" & "</a>&nbsp;"
   end if
  
   for counter=1 to totalpage
    ref=ref&"<a href="/blog/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="/blog/list_""&j+1&".html"&">" & "<FONT face=Webdings>8</FONT>" & "</a>&nbsp;"
   end if
   ref=ref&"<a href="/blog/list_""&totalpage&".html"&">" & "<FONT face=Webdings>:</FON

技术随笔 | 阅读 1137 次
文章评论,共0条
游客请输入验证码
最新评论