📄 list.asp
字号:
<link rel="stylesheet" href="../style.css" type="text/css">
<!--#include file="session.asp" -->
<!--#include file="conn.asp" -->
<%
set rs = server.CreateObject("adodb.recordset")
if request("name")<>"" then
sql = "select * from MB_Linkun order by L_ID desc"
else
sql = "select * from MB_Linkun order by L_ID desc"
end if
rs.open Sql,my_conn,1,1
'删除
if request("del")="del" then
dsql="delete * from MB_Linkun where L_ID="&request("id")
my_conn.execute dsql
response.write"<script>alert('该信息已成功删除!');location.href='list.asp?pageno="%><%=request("pageno")%><%response.write"';</Script>"
end if
%>
<p align="center">
<br>
<br>
<br>
</p>
<%
Dim TotalPage '总页数
Dim PageNo '当前显示的是第几页
Dim RecordCount '总记录条数
If RS.RecordCount=0 then
response.write "<P><center>对不起,数据库中没有相关信息!</center></P>"
response.end
else
RS.PageSize = 20
Totalpage=INT(RS.recordcount / rs.pagesize * -1)*-1 '计算可显示页面的总数
PageNo = Request.QueryString ("PageNo")
'直接输入页数跳转;
If Request.Form("PageNo")<>"" Then PageNo = Request.Form("PageNo")
'如果没有选择第几页,则默认显示第一页;
If PageNo = "" then PageNo = 1
Rs.AbsolutePage = PageNo
End If
'获取当前文件名,使得每次翻页都在当前页面进行;
Dim fileName,postion
fileName = Request.ServerVariables("script_name")
postion = InstrRev(fileName,"/")+1
'取得当前的文件名称,使翻页的链接指向当前文件;
fileName = Mid(fileName,postion)
Dim RowCount
RowCount = 20 '每页显示的记录条数
%>
<div align="center">
<center>
<table width="500" border="1" cellpadding="3" cellspacing="0" bgcolor="#000000" bordercolor="#ACACAC" style="border-collapse: collapse">
<tr align="center" valign="middle">
<td width="30" bgcolor="#BCBCBC">编号</td>
<td width="225" bgcolor="#BCBCBC">网站名称</td>
<td width="83" bgcolor="#BCBCBC">分类</td>
<td width="106" bgcolor="#BCBCBC">编辑</td>
</tr>
<%
Do while Not Rs.eof and RowCount>0
%>
<tr valign="middle" bgcolor="#DEDEDE">
<td width="30"><p align="center"><%=rs("L_ID")%> </td>
<td width="225"><a href=<%=rs("L_url")%> target="_blank"><%=rs("L_Title")%></a> </td>
<td width="83"><%=rs("L_class")%> </td>
<td width="106">
<p align="center">[<a href="edit.asp?id=<%=rs("L_ID")%>">编辑</a>] [<a href='javascript:if(confirm("确实要删除吗?"))location="list.asp?id=<%=rs("L_ID")%>&del=del&pageno=<%=pageno%>"'>删除</a>]</td>
</tr>
<%
RowCount = RowCount - 1
Rs.MoveNext
Loop
%>
</table>
</center>
</div>
<br>
<div align="center">
<center>
<table width='500' border=0 cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
<tr align="center" valign="middle">
<td width="289" height="18">
<p align="left">共计 <font color=#ff3333><%=RS.recordcount%></font> 条记录
| 共: <font color=#ff3333><%=TotalPage%></font> 页 | 当前: 第 <font color=#ff3333><%=PageNo%></font> 页</td>
<td width="211"> <div align="right">
<%If rs.RecordCount = 0 or TotalPage = 1 Then
Response.Write "当前只有一页"
Else%>
<a href="<%=fileName%>?PageNo=1">首
页</a> |
<%If PageNo - 1 = 0 Then
Response.Write "上一页|"
Else%>
<a href="<%=fileName%>?PageNo=<%=PageNo-1%>">上一页</a>
|
<%End If
If PageNo+1 > TotalPage Then
Response.Write " "
Else%>
<a href="<%=fileName%>?PageNo=<%=PageNo+1%>">下一页</a>
|
<%End If%>
<a href="<%=fileName%>?PageNo=<%=TotalPage%>">末
页</a>
<%End If%>
</div></td>
</tr>
</table>
</center>
</div>
<br>
<br>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -