⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 news.asp

📁 使用说明: 请将ASPBook文件夹直接复制到硬盘上
💻 ASP
字号:
<!--#include file="conn.inc"-->
<link href="../text.css" rel="stylesheet" type="text/css"> 
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" >
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<table width="599" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>
      <%   
set rs=server.createobject("adodb.recordset")   
sql= "SELECT * FROM shop_news order by newsid Desc "
rs.open sql,conn,1,1   
if rs.eof and rs.bof then %>
      <p align="center">&nbsp;</p>
      <p align="center">还没有公告!<br>
      </p>
      <% 
				    else
				    dim MaxPerPage
   					dim sql 
   					dim rs
   					dim gstBookID
   					dim totalPut   
   					dim CurrentPage
   					dim TotalPages
   					filename="news.asp" 
    				if not isempty(request("page")) then
      					currentPage=cint(request("page"))
   					else
      					currentPage=1
   					end if       
   					rs.pagesize=10   
   					totalPut=rs.recordcount '记录总数    
   					totalPage=rs.pagecount    
   					MaxPerPage=rs.pagesize    
      				if currentpage<1 then    
          				currentpage=1    
      				end if    
      				if currentpage>totalPage then    
          				currentpage=totalPage    
      				end if    
   					if currentPage=1 then    
      					showContent    
                        showpages1
    				else    
         				if (currentPage-1)*MaxPerPage<totalPut then    
         					rs.move  (currentPage-1)*MaxPerPage    
         					dim bookmark    
         					bookmark=rs.bookmark '移动到开始显示的记录位置    
         					showContent    
                  showpages1
      					end if    
   					end if    
      				rs.close    
					end if  
   
					   
					set conn=nothing      
					sub showContent    
     					dim i,j   
				   %>
      <table width="570" border="0" align="center" cellpadding="0" cellspacing="0" class="default">
        <tr align="center">
          <td width="41" height="28">序号</td>
          <td width="137">标题</td>
          <td width="96">发布人</td>
          <td width="62" align="right">发布日期</td>
          <td width="29">修改</td>
          <td width="30">删除</td>
        </tr>
        <% 
i=1   
do while not (rs.eof or err)%>
        <tr bgcolor="<%If (i Mod 2) Then%>#F6F6F6<%Else%>#FFFFFF<%End If%>">
          <td height="25" align="center"><%=rs("newsid")%></td>
          <td style="padding-left:10px"><a href="new_info.asp?id=<%=rs("newsid")%>" target="_blank"><%=rs("newsname")%></a></td>
          <td align="center"><%=rs("addname")%></td>
          <td align="center"><%=rs("adddate")%></td>
          <td align="center"><a href="newsm.asp?id=<%=rs("newsid")%>&page=<%=currentPage%>">修改</a></td>
          <td align="center"><a href="delnews.asp?id=<%=rs("newsid")%>&page=<%=currentPage%>">删除</a></td>
        </tr>
        <%     
    if i>=MaxPerPage then exit do  
    i=i+1     
    rs.movenext     
    loop     
   %>
        <tr>
          <td height="30" colspan="7" align="center">
            <%
end sub 
%>
            <%
sub showpages1()     
dim n     
n=totalPage
%>
            <form action="<%=filename%>" method="post" align="right">
              <table width="100%" height="30" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
                <tr>
                  <td height="30">
                    <div align="right"> <span style="font-size:9pt"> 共<font color="#FF0000"><%=totalPage%></font>页/<font color="red"><%=totalPut%></font>条信息 </span>
                        <% If currentPage <> 1 Then %>
                        <a href=<%=filename%>><font color="#FF6600"><span style="font-size:9pt">[首页]</span></font></a> <a href=<%=filename%>?Page=<%=(currentPage-1)%>><font color="#FF6600"><span style="font-size:9pt">[上一页]</span></font></a>
                        <% End If %>
                        <% If currentPage <> rs.PageCount Then %>
                        <a href=<%=filename%>?Page=<%=(currentPage+1)%>><font color="#FF6600"><span style="font-size:9pt">[下一页]</span></font></a> <a href=<%=filename%>?Page=<%=totalPage%>><font color="#FF6600"><span style="font-size:9pt">[尾页]</span></font></a>
                        <% End If %>
                        <span style="font-size:9pt"> 第<font color="#FF0000"><%=currentPage%></font>页/共<font color="#FF0000"><%=totalPage%></font>页
                        <%
response.write " 转到:<select name='page' size=1 class=smallselsect style='font-family: 宋体; font-size: 9pt;'>"     
for i=1 to n     
   response.write "<option value="& i      
   if currentpage=i then      
     response.write " selected"     
   end if     
   response.write ">"& i &"</option>"     
next     
response.write "</select>"  
response.write"<input name='types' type='hidden' value='"&request("types")&"'>"
response.write "&nbsp;<input class=buttonface type='submit'  value='go'  style='font-family: 宋体; font-size: 9pt;'>"     
%>
                    </span> </div></td>
                </tr>
              </table>
          </form></td>
        </tr>
      </table>
      <%end sub%>
      <p></p></td>
  </tr>
</table>
</td>
</tr>
</table>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -