新闻内页 “上一篇”“下一篇”
<font class="font12D">首篇:<%=nextnew(id,3)%> 上一篇:<%=nextnew(id,1)%> 下一篇:<%=nextnew(id,2)%> 尾篇 <%=nextnew(id,4)%></font>
<%
function nextnew(id2,o)
if o=1 then
sql="select top 1 * from news where id>"&id2&" order by id"
end if
if o=2 then
sql="select top 1 * from news where id<"&id2&" order by id desc"
end if
if o=3 then
sql="select top 1 * from news"
end if
if o=4 then
sql="select top 1 * from news order by id desc"
end if
set rss=conn.execute(sql)
if rss.eof then
response.Write("没有了")
else
response.Write("<a href=syjwread.asp?id="&rss("id")&">"&rss("newsname")&"</a>")
end if
end function
%>
<%
function nextnew(id2,o)
if o=1 then
sql="select top 1 * from news where id>"&id2&" order by id"
end if
if o=2 then
sql="select top 1 * from news where id<"&id2&" order by id desc"
end if
if o=3 then
sql="select top 1 * from news"
end if
if o=4 then
sql="select top 1 * from news order by id desc"
end if
set rss=conn.execute(sql)
if rss.eof then
response.Write("没有了")
else
response.Write("<a href=syjwread.asp?id="&rss("id")&">"&rss("newsname")&"</a>")
end if
end function
%>