1、nesw.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <!--#include file="conn.asp"--> <!--#include file="page.asp"--> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <style type="text/css"> <!-- body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } --> </style> </head>
<body> <table width="776" height="650" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="94" height="650" valign="top"></td> <td width="682" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td></td> </tr> <tr class="pt9"> <td height="618" valign="top" background="img/zzjg1.jpg"><table width="96%" border="0" align="center" cellpadding="0" cellspacing="0"> <%set rs=server.CreateObject("adodb.recordset") rs.open "select * from news",conn,1,3 if rs.eof and rs.bof then response.Write("暂时没有内容") else
%> <tr class="xx"> <td height="15" align="center" valign="middle"></td> </tr> <tr class="xx"> <td height="20" align="center" valign="middle"><%=rs("title")%></td> </tr>
<tr class="pt9"> <td height="32" align="center" valign="middle">发部时间:<%=rs("time")%></td> </tr> <tr class="pt9"> <td height="31" align="left" valign="middle"><%call ManualPagination()%></td> </tr> <tr class="pt9"> <td height="31" align="right" valign="middle"></td> </tr> <%end if%> </table> </td> </tr> </table> </tr> </table> </body> </html> <% set rs=nothing conn.close set conn=nothing %>
2、page.asp
<%
'================================================= '过程名:ManualPagination '作 用:采用手动分页方式显示文章内容 '参 数:无 '================================================= sub ManualPagination() dim ArtID,strContent,CurrentPage dim ContentLen,MaxPerPage,pages,i dim arrContent ArtID=rs("id") strContent=rs("content") ContentLen=len(strContent) CurrentPage=trim(request("Page")) if Instr(strContent,"[NextPage]")<=0 then response.write strContent 'response.write "</p><p align='center'><font color='red'><b>[1]</b></font></p>" else arrContent=split(strContent,"[NextPage]") pages=Ubound(arrContent)+1 if CurrentPage="" then CurrentPage=1 else CurrentPage=Cint(CurrentPage) end if if CurrentPage<1 then CurrentPage=1 if CurrentPage>pages then CurrentPage=pages response.write arrContent(CurrentPage-1) response.write "</p><p align='center'><b>" if CurrentPage>1 then response.write "<a href='?id="&ArtID&"&page="&CurrentPage-1&"'>上一页</a> " end if for i=1 to pages if i=CurrentPage then response.write "<font color='red'>[" & cstr(i) & "]</font> " else response.write "<a href='?id="&ArtID&"&page="&i&"'>["& i &"]</a> " end if next if CurrentPage<pages then response.write "<a href='?id="&ArtID&"&page="&CurrentPage+1&"'>下一页</a>" end if response.write "</b></p>" end if end sub %> |