本文由newsoftstudio.com
iuprg撰写
<%
bclassid=trim(request("bclassid"))
word =trim(request("word"))
sql= "select * from bnews where BnewsCheck=1 and bnewstitle<>'' "
sql=sql&" and (BnewsClass='"&bclassid&"')"
if tj="1" then
sql= sql & " and tj='推荐' "
end if
if hot="1" then
sql=sql & " order by bnewshit desc , bnewsid desc"
else
sql=sql & " order by bnewsontop desc , bnewsid desc"
end if
%>
<div align="center">
<table border="0" cellpadding="2" cellspacing="0" width="100%">
<%
Set Newsrs = Server.CreateObject("ADODB.RecordSet")
Newsrs.Open sql,conn,1,1
if Newsrs.recordcount<>0 then
page=int(request.QueryString ("page"))
Newsrs.PageSize=listnum
pagecount=newsrs.pagesize
if page<=0 then page=1
if request.QueryString("page")="" then page=1
newsrs.AbsolutePage=page
for i=1 to pagecount
%>
<tr>
<td align=left>
<%
bclassid=newsrs("bnewsclass")
sql2 = "select * from bclassinfo where bclassid="&bclassid
Set rs2 = Server.CreateObject("ADODB.RecordSet")
rs2.Open sql2,conn,1,1
Mybclassname=rs2("bclassname") ' by drs 2006-6-5
if newsrs("bnewstitlecolor")="默认颜色" or newsrs("bnewstitlecolor")="" then
fontcolor="999999"
else
fontcolor=newsrs("bnewstitlecolor")
end if
%>
<%=icon%><%if bclassname="1" then response.write "[<a href=bsnews_showNewsMore.asp?bclassid="&rs2("bclassid")&">"&mybclassname&"</a>] "%><a href="bsnews_newsdisplay.asp?newsid=<%=newsrs("bnewsid")%>" <%=openwindow%>><font color="<%=trim(bnewsfontcolor)%>"><%=titleb(newsrs("bnewstitle"),titleLen)%></font></a>
<font color=999999>
<%
if newshit="1" then response.write "阅读:"&newsrs("bnewshit")
if trim(newsrs("bnewspic"))<>"" then Response.Write "[图]"
%>
</td><td>
<%
MyMonth= month(newsrs("bnewsdate")) 'by drs 2006-7-28 日期显示 为 [06-28] 颜色为6d6d6d
MyDay = day(newsrs("bnewsdate"))
if cint(MyMonth)<10 then MyMonth="0"&MyMonth
if cint(MyDay )<10 then MyDay ="0"&MyDay
if newstime=1 then response.write "<font color=6d6d6d >["&formatdatetime(newsrs("bnewsdate"),1)&"]</font>"
if newstime=2 then response.write "<font color=6d6d6d >["&formatdatetime(newsrs("bnewsdate"),2)&"]</font>"
if newstime=3 then response.write "<font color=6d6d6d >["&month(newsrs("bnewsdate"))&"月"&day(newsrs("bnewsdate"))&"日]</font>"
if newstime=4 then response.write "<font color=999999 >["&MyMonth&"-"&MyDay&"]</font>"
'if newstime="1" then response.write "("&formatdatetime(rs("bnewsdate"),1)&")"
%>
</font>
</td></tr>
<%
newsrs.movenext
if newsrs.eof then exit for
next
else
response.write "<center><BR><BR><BR>请输入相关信息后才能正确显示此内容:)<BR><BR><BR><BR>"
end if
%>
</table><BR><center>
<%
if newsrs.recordcount<>0 then
if page>1 then%>
<a href='<%=request.servervariables("URL")%>?page=1&word=<%=word%>&bclassid=<%=trim(request("bclassid"))%>&bclassname=<%=trim(request("bclassname"))%>&isopen=<%=trim(request("isopen"))%>&titleLen=<%=trim(request("titleLen"))%>&hot=<%=trim(request("hot"))%>&tj=<%=trim(request("tj"))%>'>首页</a>
<a href='<%=request.servervariables("URL")%>?page=<%=page-1%>&word=<%=word%>&bclassid=<%=trim(request("bclassid"))%>&bclassname=<%=trim(request("bclassname"))%>&isopen=<%=trim(request("isopen"))%>&titleLen=<%=trim(request("titleLen"))%>&hot=<%=trim(request("hot"))%>&tj=<%=trim(request("tj"))%>'>上一页</a>
<%end if%>
<%if page<newsrs.pagecount then%>
<a href='<%=request.servervariables("URL")%>?page=<%=page+1%>&word=<%=word%>&bclassid=<%=trim(request("bclassid"))%>&bclassname=<%=trim(request("bclassname"))%>&isopen=<%=trim(request("isopen"))%>&titleLen=<%=trim(request("titleLen"))%>&hot=<%=trim(request("hot"))%>&tj=<%=trim(request("tj"))%>'>下一页</a>
<a href='<%=request.servervariables("URL")%>?page=<%=newsrs.pagecount%>&word=<%=word%>&bclassid=<%=trim(request("bclassid"))%>&bclassname=<%=trim(request("bclassname"))%>&isopen=<%=trim(request("isopen"))%>&titleLen=<%=trim(request("titleLen"))%>&hot=<%=trim(request("hot"))%>&tj=<%=trim(request("tj"))%>'>尾页</a>
<%end if%>
共<%=newsrs.recordcount%>条 每页显示<%=pagecount%>条 第<%=page%>页 共<%=newsrs.pagecount%>页
<script language="JavaScript">
<!--
function FP_jumpMenu(el,frm,sel) {//v1.0
var href=el.options[el.selectedIndex].value; if(sel) el.selectedIndex=0;
if('_new'==frm) open(href); else eval(frm+".location='"+href+"'");
}
// -->
</script>
<select size="1" οnchange="FP_jumpMenu(this,'window',false)" id="id1" name="D1" style="font-size: 9pt; border-style: solid; border-width: 1px">
<%for i=1 to newsrs.pagecount%>
<option value="<%=request.servervariables("URL")%>?page=<%=i%>&word=<%=word%>&bclassid=<%=trim(request("bclassid"))%>&bclassname=<%=trim(request("bclassname"))%>&isopen=<%=trim(request("isopen"))%>&titleLen=<%=trim(request("titleLen"))%>&hot=<%=trim(request("hot"))%>&tj=<%=trim(request("tj"))%>>" <%if page=i then response.write "selected"%>>第<%=i%>页</option>
<%next%>
</select>
</p>
<%end if%><%
end function
%>
====本文由http://www.newsoftstudio.com iuprg撰写===
显示更多新闻的代码,每页10条,由于修改疏忽
if newstime=4 then response.write "<font color=999999 '>["&MyMonth&"-"&MyDay&"]</font>"
999999后面多了一个 ' 单引号,却造成每页只显示5条的错误,至今也没想明白为什么?!