📄 show.asp
字号:
<!--#include file="conn.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>中一广告</title>
<link href="css.css" rel="stylesheet" type="text/css">
</head>
<body background="images/bg.gif" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- #include file="top.asp" -->
<table width="742" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><img src="images/2_7.gif" width="742" height="23"></td>
</tr>
</table>
<table width="742" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="104" valign="top" background="images/2_8-1.gif"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="13"><img src="images/2_8.gif" width="104" height="339"></td>
</tr>
</table></td>
<td width="625" valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="551" valign="top" bgcolor="#FFFFFF"> <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2">
<%
sql="select * from book "
%>
<%
dim rsw
dim sqlw
msg_per_page = 5 '定义每页显示记录条数
set rsw = server.createobject("adodb.recordset")
sqlw=sql
rsw.pagesize = msg_per_page '定义分页记录集每页显示记录数
rsw.open sqlw,conn,1,3
if err.number<>0 then '错误处理
response.write "数据库操作失败:" & err.description
err.clear
else
if not (rsw.eof and rsw.bof) then '检测记录集是否为空
totalrec = RSw.RecordCount 'totalrec:总记录条数
if rsw.recordcount mod msg_per_page = 0 then '计算总页数,recordcount:数据的总记录数
n = rsw.recordcount\msg_per_page 'n:总页数
else
n = rsw.recordcount\msg_per_page+1
end if
currentpage = request("page") 'currentpage:当前页
If currentpage <> "" then
currentpage = cint(currentpage)
if currentpage < 1 then
currentpage = 1
end if
if err.number <> 0 then
err.clear
currentpage = 1
end if
else
currentpage = 1
End if
if currentpage*msg_per_page > totalrec and not((currentpage-1)*msg_per_page < totalrec)then
currentPage=1
end if
rsw.absolutepage = currentpage 'absolutepage:设置指针指向某页开头
rowcount = rsw.pagesize 'pagesize:设置每一页的数据记录数
%>
<% do while not rsw.eof and rowcount > 0 %>
<table width="92%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50"> </td>
<td class="14"><%=rsw("name")%></td>
</tr>
<tr>
<td> </td>
<td class="14"><%=rsw("connt")%> </td>
</tr>
<tr>
<td height="16"> </td>
<td background="images/bg2.gif"> <div align="right" class="13">
<a href="#" target="_self" onclick="window.open('xiang.asp?id=<%=rsw("id")%>','play','width=556,height=463')" class="13"><font color="#009EEA" >[点击查看]</font></a>
</div></td>
</tr>
</table>
<%
k=k+1
rowcount=rowcount-1
rsw.MoveNext
loop
%>
<%
else
%>
没有结果
<%
end if
end if
rsw.close
set rsw=nothing
%>
</td>
</tr>
<tr>
<td width="10%"> </td>
<td width="90%" class="13">
<%call listPages()%>
</td>
</tr>
</table></td>
<td width="9" > </td>
</tr>
</table></td>
</tr>
</table></td>
<td width="10" valign="top" bgcolor="#FFFFFF" class="bg2"> </td>
</tr>
</table>
<table width="742" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><!-- #include file="bottom.asp" --></td>
</tr>
</table>
</body>
</html>
<%
sub listPages()
if n <= 1 then exit sub
for i=0 to n\msg_per_page-1
for j=1 to msg_per_page
%>
<a href="<%=request.ServerVariables("script_name") %>?page=<%=i*msg_per_page+j %>" class="13">[<% =i*msg_per_page+j %>]</a>
<%
next
next
EndPage = n mod msg_per_page
for j=1 to EndPage
%>
<a href="<%=request.ServerVariables("script_name")%>?page=<% =i*msg_per_page+j %>" class="13">[<% =i*msg_per_page+j %>]</a>
<%next%>
当前页:<%=currentpage%>/<%=n%>页 <%=msg_per_page%>条记录/页 总计:<%=totalrec%>条记录
<%end sub%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -