发信人: dager()
整理人: netyum(2002-07-23 19:01:35), 站内信件
|
<%
dim conn
dim connstr
on error resume next
connstr="DBQ="+server.mappath("news.mdb")+";DefaultDir=;DRIVER={Mic rosoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>显示文件</title>
</head>
<%
dim bankuai
'=============================
bankuai=13 '定义版块名称和显示条数
const MaxPerPage=10 '定义每页新闻条数目
'=============================
dim totalPut
dim CurrentPage
dim TotalPages
dim i,j
dim typename
typename="" '在此输入标题
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
%>
<body>
<%
dim sql
dim rs
sql="select * from news where bkfl="& bankuai &" order by new_id desc"
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "<p align='center'> 还 没 有 任 何 文 章</p>"
else
totalPut=rs.recordcount
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
'showpage totalput,MaxPerPage,"index.asp"
showContent
showpage totalput,MaxPerPage,"index.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
'showpage totalput,MaxPerPage,"index.asp"
showContent
showpage totalput,MaxPerPage,"index.asp"
else
currentPage=1
showpage totalput,MaxPerPage,"index.asp"
showContent
showpage totalput,MaxPerPage,"index.asp"
end if
end if
rs.close
end if
set rs=nothing
conn.close
set conn=nothing
sub showContent
dim i
i=0
%> <table border="0" cellspacing="0">
<tr>
<td></td>
</tr>
<!------------------->
<%do while not rs.eof%>
<tr>
<td >● <a href="newste mp002.asp?new=<%=rs("new_id")%>"><%=rs("title")%> <font size= "2" color="#808080">阅读<%=rs("hit")%>次 <%=rs("time")%></ td>
</tr>
<% i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
%> </table>
<!------------------------------>
<%
end sub
function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
response.write "<p align='center'>>>分页 "
if CurrentPage<2 then
response.write "首页 上一页 "
else
response.write "<a href="&filename&"?page=1&>首页 "
response.write "<a href="&filename&"?page="&CurrentPage-1&">上一页 "
end if
if n-currentpage<1 then
response.write "下一页 尾页"
else
response.write "<a href="&filename&"?page="&(CurrentPage+1)
response.write ">下一页 <a href="&filename&"?page="&n&">尾页</ a>"
end if
response.write " 页次:<strong>"&CurrentPage&" /"&n&"</strong>页 "
response.write " 共"&totalnumber&"篇 "&maxperpage&" 篇/页 "
end function
%>
</body>
</html>
-- i wanna get next to you.
※ 来源:.月光程序代码网 http://www.moon-soft.com.[FROM: 202.105.42.195]
|
|