asp页面怎么实现上一篇下一篇的功能啊??麻烦高手告诉我,详细点~我asp刚刚学~~
<body><tablewidth="800"border="0"align="center"cellpadding="0"cellspacing="0"><tr><td...
<body>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3"><!--#include file="inc/head.asp"--></td>
</tr>
<tr>
<td width="220" align="right" valign="top">
<!--#include file="inc/login.asp"-->
<!--#include file="inc/search.asp"-->
<!--#include file="inc/link.asp"-->
<!--#include file="inc/down.asp"--></td>
<td width="25"> </td>
<td width="555" valign="top">
<table width="1%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="image/bg.jpg"/></td>
</tr>
<tr>
<td><img src="image/news.jpg" alt="就业新闻" width="309" height="34" border="0" usemap="#Map2" />
<map name="Map2" id="Map2">
<area shape="rect" coords="20,6,85,28" href="news.asp" alt="返回就业新闻" />
</map></td>
</tr>
</table>
<table width="550" border="0" cellpadding="0" cellspacing="2">
<tr>
<td width="30" rowspan="5"> </td>
<td width="431" class="STYLE3"><font color="#000080"><span lang="zh-cn"><font color=#000080><span class="STYLE6">当前位置:<a href= index.asp><font color=#000080>首页</font></a> >>> <font color=#000080><a href="news.asp">就业新闻</a></font><font color=#000080></font></span></span></font>
<td>
</td>
<td width="30" rowspan="3"> </td>
</tr>
<tr>
<td align="center" class="STYLE4">
</td>
</tr>
<tr>
<td align="center" class="STYLE4"><%=rs("I_title")%></td>
</tr>
<tr>
<td colspan="2" align="right" class="STYLE2"><div align="left"> 发布时间:<%=rs("I_time")%> 查看次数:<%=rs("I_ck")%>次</div></td>
</tr>
<tr>
<td align="left" class="STYLE2 STYLE5"><% =rs("I_container") %></td>
</tr>
<tr>
<td colspan="3" align="center"><%if rs("pic")<>"" then%><img src= "down/<%=rs("pic")%>" width="500"/><%end if%></td>
</tr>
<TR>
<TD colspan="3" align="center">
<%if rs("pic1")<>"" then %><img src= "down/<%=rs("pic1")%>" width="500" /><%end if%> </TD>
</TR>
</table></td>
</tr>
<tr>
<td colspan="3"><!--#include file="inc/foot.asp"--></td>
</tr>
</table>
</form>
</body>
这个是整个页面,具体告诉我要把代码添加到哪啊
这下面是网页前面的内容~
<!--#include file="conn.asp"-->
<%
if request.QueryString("id")="" then
response.Write "<script>alert('参数错误!');"
response.Write "window.location.href='index.asp';</script>"
end if
set rs=server.CreateObject("adodb.recordset")
sql="select * from Information where key='news' and I_id="& request.QueryString("id")
rs.open sql,conn,1,3
%>
<link href="inc/css.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.STYLE3 {font-size: 16px}
.STYLE4 {font-size: 18px}
.STYLE5 {font-size: 14}
-->
</style>
</head> 展开
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3"><!--#include file="inc/head.asp"--></td>
</tr>
<tr>
<td width="220" align="right" valign="top">
<!--#include file="inc/login.asp"-->
<!--#include file="inc/search.asp"-->
<!--#include file="inc/link.asp"-->
<!--#include file="inc/down.asp"--></td>
<td width="25"> </td>
<td width="555" valign="top">
<table width="1%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="image/bg.jpg"/></td>
</tr>
<tr>
<td><img src="image/news.jpg" alt="就业新闻" width="309" height="34" border="0" usemap="#Map2" />
<map name="Map2" id="Map2">
<area shape="rect" coords="20,6,85,28" href="news.asp" alt="返回就业新闻" />
</map></td>
</tr>
</table>
<table width="550" border="0" cellpadding="0" cellspacing="2">
<tr>
<td width="30" rowspan="5"> </td>
<td width="431" class="STYLE3"><font color="#000080"><span lang="zh-cn"><font color=#000080><span class="STYLE6">当前位置:<a href= index.asp><font color=#000080>首页</font></a> >>> <font color=#000080><a href="news.asp">就业新闻</a></font><font color=#000080></font></span></span></font>
<td>
</td>
<td width="30" rowspan="3"> </td>
</tr>
<tr>
<td align="center" class="STYLE4">
</td>
</tr>
<tr>
<td align="center" class="STYLE4"><%=rs("I_title")%></td>
</tr>
<tr>
<td colspan="2" align="right" class="STYLE2"><div align="left"> 发布时间:<%=rs("I_time")%> 查看次数:<%=rs("I_ck")%>次</div></td>
</tr>
<tr>
<td align="left" class="STYLE2 STYLE5"><% =rs("I_container") %></td>
</tr>
<tr>
<td colspan="3" align="center"><%if rs("pic")<>"" then%><img src= "down/<%=rs("pic")%>" width="500"/><%end if%></td>
</tr>
<TR>
<TD colspan="3" align="center">
<%if rs("pic1")<>"" then %><img src= "down/<%=rs("pic1")%>" width="500" /><%end if%> </TD>
</TR>
</table></td>
</tr>
<tr>
<td colspan="3"><!--#include file="inc/foot.asp"--></td>
</tr>
</table>
</form>
</body>
这个是整个页面,具体告诉我要把代码添加到哪啊
这下面是网页前面的内容~
<!--#include file="conn.asp"-->
<%
if request.QueryString("id")="" then
response.Write "<script>alert('参数错误!');"
response.Write "window.location.href='index.asp';</script>"
end if
set rs=server.CreateObject("adodb.recordset")
sql="select * from Information where key='news' and I_id="& request.QueryString("id")
rs.open sql,conn,1,3
%>
<link href="inc/css.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.STYLE3 {font-size: 16px}
.STYLE4 {font-size: 18px}
.STYLE5 {font-size: 14}
-->
</style>
</head> 展开
展开全部
首先,楼主贴的代码不完整.
rs记录集应该贴上来,看上面的代码,应该在其它文件.
上一页,下一页的原理是
获取当前新闻的ID,如
id = request("id")
上一页就是
rs.open "select id,I_title from news where id <"&id,conn,1,1
<a href=news.asp?id=<%=rs("id")%>>上一篇</a>
下一页就是
rs.open "select id,I_title from news where id >"&id,conn,1,1
<a href=news.asp?id=<%=rs("id")%>>下一篇</a>
因为没贴出相应字段,我随便写的,根据你自己的字段进行修改一下,我只是做个示范,请楼主自行修改一下即可.
rs记录集应该贴上来,看上面的代码,应该在其它文件.
上一页,下一页的原理是
获取当前新闻的ID,如
id = request("id")
上一页就是
rs.open "select id,I_title from news where id <"&id,conn,1,1
<a href=news.asp?id=<%=rs("id")%>>上一篇</a>
下一页就是
rs.open "select id,I_title from news where id >"&id,conn,1,1
<a href=news.asp?id=<%=rs("id")%>>下一篇</a>
因为没贴出相应字段,我随便写的,根据你自己的字段进行修改一下,我只是做个示范,请楼主自行修改一下即可.
展开全部
哪个是自动编号的字段?一般是id吧?
id=request("id")
上一篇:
<% rs.open "select top 1 * from news where id <"&id&" order by id desc"%>
<a href=news.asp?id=<%=rs("id")%>><%=rs("I_title")%></a>
下一篇:<% rs.open "select top 1 * from news where id>"&id&" order by id asc "%>
<a href=news.asp?id=<%=rs("id")%>><%=rs("I_title")%></a>
id=request("id")
上一篇:
<% rs.open "select top 1 * from news where id <"&id&" order by id desc"%>
<a href=news.asp?id=<%=rs("id")%>><%=rs("I_title")%></a>
下一篇:<% rs.open "select top 1 * from news where id>"&id&" order by id asc "%>
<a href=news.asp?id=<%=rs("id")%>><%=rs("I_title")%></a>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询