上一篇.下一篇连接问题.
一般情况下,在看某网站文章的时候,在文章的最下面都会列出上一篇和下一篇的连接.并写出了那两篇的文章名称.很想知道.这是怎么实现的呢???有空的话,说下那步骤和那代码啊`~感谢万分啊~
这应该是分页技术
第一页|上一页|下一页|最后一页!--#include file="Function/conn.inc"-->
<!--#include file="Function/Function.asp"-->
<%
sql="select * from GOCOL_system"
rs.open sql,conn,1,1
Web_Name=rs("Web_Name")
Http=rs("Http")
Admin_Email=rs("Admin_Email")
Web_Logo=rs("Web_Logo")
metakey=rs("metakey")
Page_Exit=rs("Page_Exit")
metades=rs("metades")
copyright=rs("copyright")
rs.close
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="Keywords" content="<%=metakey%>">
<meta name="Description" content="<%=metades%>">
<%=Page_Exit%>
<title><%=Web_Name%></title>
<link href="inc/css.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" type="text/javascript" src="js/openpopups.js"></script>
<style type="text/css">
<!--
body,td,th {
color: #cccccc;
}
body {
background-color: #820405;
}
a:link {
color: #CCCCCC;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #CCCCCC;
}
a:hover {
text-decoration: underline;
color: #666666;
}
a:active {
text-decoration: none;
color: #CCCCCC;
}
.links {
border: 1px solid #000000;
}
-->
</style>
<SCRIPT language=JavaScript>
function Cbg(obj, objColor)
{
obj.style.backgroundColor=objColor
}
</SCRIPT>
</head>
<body>
<!--#include file="top.asp"-->
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="6%" rowspan="2" valign="top" bgcolor="#460000"> </td>
<td width="88%" height="500" align="center" valign="top" bgcolor="#820405"><table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="250" valign="top"><table width="250" border="1" cellpadding="0" cellspacing="0" bordercolor="#460000" style="border-collapse:collapse; margin-top:10px;">
<tr>
<td height="30" align="left" valign="middle" bgcolor="#700303"> 文章分类</td>
</tr>
<tr>
<td height="111" align="center" valign="top">
<%
sql="select * from gocol_news_types order by num"
rs.open sql,conn,1,1
do while not rs.eof
%>
<div align="left" style="margin-left:10; margin-top:10px;"> <a href="Blog.asp?class=<%=rs("id")%>"><%=rs("types")%>
<%
m_SQL = "SELECT Count(*) FROM news where classid="&rs("id")
Set rst = conn.Execute(m_SQL)
Response.write ("("&rst(0)&")")
rst.Close
%></a></div>
<%
rs.movenext
loop
rs.close
%>
<br> </td>
</tr>
</table><br> <table width="250" border="1" cellpadding="0" cellspacing="0" bordercolor="#460000" style="border-collapse:collapse; margin-top:10px;">
<tr>
<td height="30" align="left" valign="middle" bgcolor="#700303"> 最近更新文章</td>
</tr>
<%
sql="select top 10 * from news where 1=1"
classid=request.QueryString("class")
if not isNumeric(classid) then
response.write "非法操作!已被禁止!"
response.End()
end if
if classid<>"" then
sql=sql&" and classid="&classid
end if
sql=sql&" order by id desc"
rs.open sql,conn,1,1
i=1
do while not rs.eof and i < 10
%>
<tr onMouseOver="Cbg(this, '#aa0000')" onMouseOut="Cbg(this, '#820405')">
<td height="24" align="left" valign="middle"> <a href="Blogred.asp?id=<%=rs("id")%>" title="<%=rs("title")%>"><font color="#CCCCCC"><%=Code(rs("title"),30)%></font></a></td>
</tr>
<% rs.moveNEXT
i=i+1
loop
rs.close
%>
</table>
<table width="250" border="1" cellpadding="0" cellspacing="0" bordercolor="#460000" style="border-collapse:collapse; margin-top:10px;">
<tr>
<td height="30" align="left" valign="middle" bgcolor="#700303"> 热门排行</td>
</tr>
<%
sql="select top 10 * from news where 1=1"
classid=request.QueryString("class")
if not isNumeric(classid) then
response.write "非法操作!已被禁止!"
response.End()
end if
if classid<>"" then
sql=sql&" and classid="&classid
end if
sql=sql&" order by hits desc"
rs.open sql,conn,1,1
i=1
do while not rs.eof and i < 10
%>
<tr onMouseOver="Cbg(this, '#aa0000')" onMouseOut="Cbg(this, '#820405')">
<td height="24" align="left" valign="middle"> <a href="Blogred.asp?id=<%=rs("id")%>" title="<%=rs("title")%>"><font color="#CCCCCC"><%=Code(rs("title"),28)%></font></a></td>
</tr>
<% rs.moveNEXT
i=i+1
loop
rs.close
%>
</table> </td>
<td valign="top">
<table width="98%" border="1" align="right" cellpadding="0" cellspacing="0" bordercolor="#460000" style="border-collapse:collapse; margin-top:10px;">
<tr>
<td height="30" align="left" valign="middle" bgcolor="#700303"> 文章列表</td>
</tr>
<tr>
<td height="700" align="center" valign="top"><table width="100%" frame=below border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#460000" style="border-collapse:collapse;">
<%
sql="select * from news where 1=1"
classid=request.QueryString("class")
if not isNumeric(classid) then
response.write "非法操作!已被禁止!"
response.End()
end if
if classid<>"" then
sql=sql&" and classid="&classid
likurl="&class="&classid
end if
sql=sql&" order by id desc"
rs.open sql,conn,1,1
if rs.eof or rs.bof then
else %>
<% rs.pagesize=30 %>
<% if request("page")="" then
page=1
else
page=CLng(request("page"))
end if
%>
<%
IF page<1 Then
page=1
end if
If page>rs.pagecount Then
page=rs.pagecount
rs.absolutepage=page
end if
%>
<%
rs.absolutepage=cint(page)%>
<% for ipage=1 to rs.pagesize
%>
<tr onMouseOver="Cbg(this, '#aa0000')" onMouseOut="Cbg(this, '<%=bg%>')">
<td width="25" height="24" align="center" valign="middle"><img src="images/jiantou.gif" width="9" height="9" align="absmiddle"></td>
<td height="24" align="left"> <a href="Blogred.asp?id=<%=rs("id")%>" title="<%=rs("title")%>"><font color="#CCCCCC"><%=rs("title")%></font></a></td>
<td width="90" height="24" align="left" valign="middle"> <%=rs("time")%></td>
<td width="50" height="24" align="center" valign="middle"><%=rs("hits")%></td>
</tr>
<% rs.moveNEXT
IF rs.EOF Then
Exit For
End If
next
end if
%>
</table>
<%if page >=1 then%>
<table border="0" align="center" cellpadding="0" cellspacing="2" bordercolor="#000000" style="margin-top:10px; margin-bottom:10px; ">
<tr bgcolor="#700303">
<%
'翻页控制代码
IF page<>1 Then
%>
<td width="30" height="20" align="center" valign="middle" bgcolor="#700303" class="links"><a href="Blog.asp?page=1<%=likurl%>" title="第一页"><font color="#000000" style="text-decoration:none; ">|<<</font></a></td>
<td width="30" height="20" align="center" valign="middle" bgcolor="#700303" class="links"><a href="Blog.asp?page=<%=page-1%><%=likurl%>" title="上一页"><font color="#000000" style="text-decoration:none; "><<</font></a></td>
<%Else %>
<td width=30 align=center bgcolor="#700303" class=links>|<<</td>
<td width=30 align=center bgcolor="#700303" class=links><<</td>
<% End IF
if page<> 1 then
for i=4 to 1 Step -1
for s=1 to 4
if (page-i)<=0 then
i=i-1
end if
next
%>
<td width="30" height="20" align="center" valign="middle" bgcolor="#700303" class="links"><a href="Blog.asp?page=<%=page-i%><%=likurl%>"><font color="#000000" style="text-decoration:none; "><%=page-i%></font></a></td>
<%
next
end if
%>
<td width="30" height="20" align="center" valign="middle" bgcolor="#aa0000" class="links"><a href="Blog.asp?page=<%=page%><%=likurl%>"><font color="#ffffff" style="text-decoration:none; "><strong><%=page%></strong></font></a></td>
<%
for i=1 to 4
if (page+i)>rs.pagecount then
exit for
end if
%>
<td width="30" height="20" align="center" valign="middle" bgcolor="#700303" class="links"><a href="Blog.asp?page=<%=page+i%><%=likurl%>"><font color="#000000" style="text-decoration:none; "><%=page+i%></font></a></td>
<%
next
%> <%IF page<>rs.pagecount then%>
<td width="30" height="20" align="center" valign="middle" bgcolor="#700303" class="links"><a href="Blog.asp?page=<%=page+1%><%=likurl%>" title="下一页"><font color="#000000" style="text-decoration:none; ">>></font></a></td>
<td width="30" height="20" align="center" valign="middle" bgcolor="#700303" class="links"><a href="Blog.asp?page=<%=rs.pagecount%><%=likurl%>" title="最后一页"><font color="#000000" style="text-decoration:none; ">>>|</font></a></td>
<%Else %>
<td width=30 align=center bgcolor="#700303" class=links>>></td>
<td width=30 align=center bgcolor="#700303" class=links>>>|</td>
<%End IF
%>
</tr>
</table>
<%end if%> </td>
</tr>
</table></td>
</tr>
</table>
<br />
<br>
</td>
<td width="6%" rowspan="2" valign="top" bgcolor="#460000"> </td>
</tr>
<tr>
<td height="80" align="center" valign="middle" bgcolor="#460000" class="JJ"><%=copyright%></td>
</tr>
</table>
</body>
</html>