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

📄 news.asp

📁 这是作的一个网站,修改很方便,可以做网站设计.管理登陆:admin.asp 帐号和密码:admin/admin
💻 ASP
字号:
<!--#include file="Gaobei_head.asp" -->
<%
sub navigation()
response.write " &gt;&gt; "
response.write "本站新闻"
end sub
%>
<%
    page_count = 20
    MaxPerPage=page_count '分页显示的纪录个数
    dim sql 
    dim rs
    dim gstBookID
    dim totalPut 
    dim CurrentPage
    dim TotalPages
    dim i,j 
%>
<div align="center">
	<table border="0" cellpadding="0" cellspacing="0" width="778" height="50" bgcolor="#FFFFFF">
		<tr>
			<td width="218" valign="top">
<% call userlogin() %>
<% Call Gaobei_Marquee() %>
<% call Gaobei_Search() %>
<% call Gaobei_vote() %>
</td>
			<td width="560" valign="top">
<div align="center">
				<table border="0" cellpadding="0" cellspacing="0" width="550" height="20" id="table1" background="images/Gaobei_skin/gaobei_newview.gif">
					<tr>
						<td> </td>
					</tr>
				</table>
</div>
<div align="center">
	<table border="0" cellpadding="0" cellspacing="0" width="550" height="5">
		<tr>
			<td></td>
		</tr>
	</table>
</div>
<div align="center">
	<table border="0" cellpadding="0" cellspacing="0" width="550" height="160" style="border: 1px solid #3399FF; ">
		<tr>
			<td bgcolor="#FFFFFF" width="150">   
<!--推荐图片新闻开始-->
<div align="center">
<div align="center">
	<table border="0" cellpadding="0" cellspacing="0" width="50" height="10">
		<tr>
			<td></td>
		</tr>
	</table>
</div>
				<table border="0" cellpadding="0" cellspacing="0" width="10" height="10">
					<tr>
						<td>
<%
    set RsPic=server.createobject("adodb.recordset")
    sql="select top 5 * from News where Ispic=1 ORDER BY id DESC"
    RsPic.open sql,conn,1,1
    if RsPic.eof or RsPic.bof then
    Call NoPic("暂无图文新闻")
    end if
    do while not RsPic.eof 
    Call Gaobei_NewsShowPic(RsPic("Pic"),RsPic(0),RsPic("Title"),130,100,18)
    RsPic.movenext
    loop
    RsPic.CLOSE
    SET RsPic=Nothing
%>
</td>
					</tr>
				</table>
	</div>
<!--推荐图片新闻结束-->
			</td>
			<td bgcolor="#FFFFFF" width="398">
<!-- 新闻列表开始-->						
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                  <tr> 
                    <td width="100%" valign="top"> <br> 
<%
    sql="select * from news ORDER BY id DESC"
    set rs=server.createobject("adodb.recordset")
    rs.open sql,conn,1,1
    'Set Rs=Conn.Execute("select * from news ORDER BY id DESC")
    rs.pagesize=MaxPerPage 
    If trim(Request("Page"))<>"" and IsNumeric(Request("Page")) then
	CurrentPage= CLng(request("Page")) 
	If CurrentPage< 1 then
		CurrentPage= 1 
	ElseIf CurrentPage> rs.PageCount then 
		CurrentPage = rs.PageCount 
	End If 
    Else 
	CurrentPage= 1 
    End If 
    if rs.eof then 
	response.write "<p align='center'>还没有添加新闻...</p>" 
    else 
	totalPut=rs.recordcount '记录总数 
	if CurrentPage=1 then 
		showContent  
		showpages
	else 
		if (currentPage-1)*MaxPerPage<totalPut then 
			rs.move(currentPage-1)*MaxPerPage 
			dim bookmark 
			bookmark=rs.bookmark '移动到开始显示的记录位置 
			showContent 
			showpages 
		else 
			currentPage=1 
			showContent 
		end if
	end if 
	rs.close 
    end if 
    set rs=nothing 
    set conn=nothing 
    sub showContent
%>
                      <TABLE width="100%" align="center" cellspacing="2" >
<%
    dim i 
    i=0 
    do while not (rs.eof or err)
%>
                        <tr> 
                          <td width="26" height="30"> <div align="right"><img src="Images/Gaobei_doc.gif" align="absmiddle"></div></td>
                          <td width="229"><div align="left"><a href="NewsInfo.asp?id=<%response.write rs(0)%>" title="<%=rs("title")%>"> 
<% if Getlen(rs("title"))>35 then%>
<%=LeftStr(rs("title"),30)%>... 
<%else%>
<%response.write rs("title")%>
<%end if%>
                              </a></div></td>
                          <td width="128">[ <%=rs("time")%> ]</td>
                        </tr>
<%
    i=i+1
    if i>=MaxPerPage then exit do
    rs.movenext 
    loop
%>
                      </TABLE>
<%end sub%>
<%sub showpages()%>
                      <br> <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr> 
                          <td height="28" align="right"> 
<% 
    dim n,k 
    if (totalPut mod MaxPerPage)=0 then
    n= totalPut \ MaxPerPage
    else
    n= totalPut \ MaxPerPage + 1
    end if
%>
                            共有<%=rs.recordcount%>个记录 &nbsp;每页<%=Page_count%>个记录
<%
    k=currentPage
    if k=1 then
	response.write " 首页 "& vbCrLf
	response.write " 上一页 "& vbCrLf
    end if
    if k<>1 then
	response.write "<a href='News.asp?page=1'> 首页 </a>"
	response.write "<a href='News.asp?page="+cstr(k-1)+"'> 上一页 </a>"
    end if
    if k=n then
	response.write " 下一页 "& vbCrLf
	response.write " 末页&nbsp;&nbsp;&nbsp;&nbsp;"& vbCrLf
    end if
    if k<>n then
	response.write "<a href='News.asp?page="+cstr(k+1)+"'> 下一页 </a>"
	response.write "<a href='News.asp?page="+cstr(n)+"'> 末页 </a>&nbsp;&nbsp;&nbsp;&nbsp;"
    end if
%>
                          </td>
                        </tr>
                      </table>
<% end sub %>
                    </td>
                  </tr>
                </table>				
<!-- 新闻列表结束-->
</td>
		</tr>
	</table>
</div>
			</td>
		</tr>
	</table>
</div>
<!--#include file="Gaobei_foot.asp" -->

⌨️ 快捷键说明

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