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

📄 chknews.asp

📁 时代购物系统 4.0功能升级说明 <1>完善了3.0的VIP
💻 ASP
字号:
<!--#include file="conn.asp"-->
<!--#include file="config.asp"--> 
<!--#include file="include/header.asp"--> 
<title><%=webname%>--新闻快讯</title> 
<TABLE WIDTH="760" BORDER="0" ALIGN="center" CELLPADDING="1" CELLSPACING="1" BGCOLOR=<%=bgclr1%>> 
<TR> 
<TD HEIGHT="20" WIDTH="100%" ALIGN="center"><FONT COLOR="#FFFFFF">新闻快讯</FONT></TD>
</TR> 
<TR> 
<TD HEIGHT="140" VALIGN="top" BGCOLOR=<%=bgclr4%> WIDTH="100%">
<%
				Const MaxPerPage=20
   				dim totalPut   
   				dim CurrentPage
   				dim TotalPages
   				dim j
   				dim sql
    			if Not isempty(request("page")) then
      				currentPage=Cint(request("page"))
   				else
      				currentPage=1
   				end if 
		 set rs=server.createobject("adodb.recordset")
	rs.open "select newsid,newsname,newscontent,addname,adddate from news order by adddate desc",conn,1,1
		  
				if err.number<>0 then
				response.write "数据库中暂时无数据"
				end if
				
  				if rs.eof And rs.bof then
       				Response.Write "<p align='center' class='contents'> 您还没有添加新闻!</p>"
   				else
	  				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
            			showContent
            			showpage totalput,MaxPerPage,"chknews.asp"
       				else
          				if (currentPage-1)*MaxPerPage<totalPut then
            				rs.move  (currentPage-1)*MaxPerPage
            				dim bookmark
            				bookmark=rs.bookmark
            				showContent
             				showpage totalput,MaxPerPage,"chknews.asp"
        				else
	        				currentPage=1
           					showContent
           					showpage totalput,MaxPerPage,"chknews.asp"
	      				end if
	   				end if
   				   				end if

   				sub showContent
       			dim i
	   			i=0

			%> 
<TABLE WIDTH="90%" BORDER="0" ALIGN="center" CELLPADDING="1" CELLSPACING="1" BGCOLOR=<%=bgclr2%>> 
<TR ALIGN="center" bgcolor="<% = bgclr1 %>"> 
<TD width="51%">新闻主题</TD>
<TD width="24%">发布人</TD>
<TD width="25%">发布时间</TD></TR> 
<%do while not rs.eof%>
 <TR ALIGN="center">
 <TD BGCOLOR=<%=bgclr4%> STYLE="PADDING-LEFT: 6px" align="left">
 <a href=# onClick="javascript:window.open('newsedit.asp?id=<% = rs("newsid") %>','','width=500,height=300,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=yes');return false;">
<%=trim(rs("newsname"))%></A></TD>
 <TD BGCOLOR=<%=bgclr4%>> <%=trim(rs("addname"))%></TD>
 <TD BGCOLOR=<%=bgclr4%>><%=rs("adddate")%></TD></TR> 
<%i=i+1
			if i>=MaxPerPage then Exit Do
			rs.movenext
		  loop
		  rs.close
		  set rs=nothing%></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 %>
				
				<form method=Post action= <% = filename %>>
				<p align='center'> 
				<%
				If CurrentPage<2 Then  %>
				首 页 上一页
				<%
				Else   %>
				<a href=<% = filename %>?page=1>首 页</a>
				<a href=<% = filename %>?page=<% = CurrentPage-1 %>>上一页</a>
				<%
				End If	
				If n-currentpage<1 Then  %>
				下一页 末 页
				<%
				Else   %>
				<a href=<% = filename %>?page=<% = (CurrentPage+1) %>>下一页</a>
				<a href=<% = filename %>?page=<% = n %>>末 页</a>
				<%
				End If  %>
					第 <b><% = CurrentPage %></b> 页 共 <b><% = n %></b> 页
				共&nbsp;<b><% = totalnumber %></b>&nbsp;条新闻 每页 <b><% = maxperpage %></b> 条新闻
				转到第:<input type='text' name='page' size=2 maxlength=10 class=smallInput value=<% = currentpage %>>
				页<input type='submit'  class='contents' value='跳转' name='cndok'></form>
				<%
				End Function  
			%> </TD></TR> </TABLE>
			<!--#include file="include/footer.asp"--> 
<script language=javascript>
function mm()
{
   var a = document.getElementsByTagName("input");
   if(a[0].checked==true){
   for (var i=0; i<a.length; i++)
      if (a[i].type == "checkbox") a[i].checked = false;
   }
   else
   {
   for (var i=0; i<a.length; i++)
      if (a[i].type == "checkbox") a[i].checked = true;
   }
}
</script>

⌨️ 快捷键说明

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