asp 上一篇,下一篇文章实例代码
我们这里是一款asp教程 上一篇,下一篇文章实例代码哦,原理很简单是获取当前文档的编号,如果是上一篇就用当前select * top 1 from bb where id>1 下一篇就是id<1哦。
Function prev_pic(Url,Id)
Sql="Select Top 1 * From young Where Id>"&id&" Order By Id Asc "
Call Opendb()
Set Rs0=Conn.Execute(Sql)
If Not Rs0.Eof Then
Response.Write("<a href="&url&"?Id="&Rs0(0)&" Class=tomg ><img src=pic/pre.gif border=0 /></a><div></div><a href="&url&"?Id="&Rs0(0)&" Class=tomg><img src="&Rs0(1)&" Width=110 /></a><br>"&Left(Rs0(4),5))
Else
Response.write("没有了<br><img src=pic/pre.gif border=0 />")
End If
Rs0.close
Set Rs0=nothing
End Function
Function Next_pic(Url,id)
Sql="Select Top 1 * From young Where Id<"&id&" Order By Id Desc "
Call Opendb()
Set Rs1=Conn.Execute(Sql)
If Not Rs1.Eof Then
Response.Write("<a href="&url&"?Id="&Rs1(0)&" Class=tomg ><img src=pic/next.gif border=0 /></a><div></div><a href="&url&"?Id="&Rs1(0)&" Class=tomg><img src="&Rs1(1)&" Width=60 /></a><br>"&Left(Rs1(4),5))
Else
Response.write("没有了<br><img src=pic/next.gif border=0 />")
End If
Rs1.close
Set Rs1=nothing
End Function
补充:asp教程,技巧与性能优化