<% dim rs,sql dim MaxPerPage dim totalPut dim CurrentPage dim TotalPages '每页显示的新闻数 MaxPerPage=20 '判断传过来的页数参数,如果不为空,则为所选页,否则缺省第一页 if not isempty(request("page")) then currentPage=cint(request("page")) else currentPage=1 end if SmallClassID=trim(request("SmallClassID")) SmallClassName=trim(request("SmallClassName")) %> 马迪笛子艺术网站·笛箫文选
   
 
<% set rs1=server.CreateObject("Adodb.RecordSet") rs1.source="select * from SmallClass order by SmallClassID" rs1.open rs1.source,conn,1,1 SmallClassCount=rs1.RecordCount dim ArraySmallClassID(20),ArraySmallClassName(20) for i=1 to SmallClassCount ArraySmallClassID(i)=rs1("SmallClassID") ArraySmallClassName(i)=trim(rs1("SmallClassName")) rs1.MoveNext next rs1.Close set rs1=nothing %>        <% for i=1 to SmallClassCount %> 〖<%=ArraySmallClassName(i)%>〗  <% Next %>
 
 
8 【<%=SmallClassName%>】  
<% '------------------------------------------------------------显示文章 set rs2=server.CreateObject("ADODB.RecordSet") rs2.Source="select * from Article where SmallClassName='" & SmallClassName &"' order by UpdateTime DESC" rs2.Open rs2.Source,conn,1,1 totalPut=rs2.recordcount '总记录行数 '===============直接输入页数的防止措施=============== '小于1,变为第一页 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,"SmallClass.asp" else if (currentPage-1)*MaxPerPage <% '=================显示文章内容的子程序================ sub showContent dim i i=0 %> <% do while not rs2.EOF Title=trim(rs2("ArticleTitle")) TitleLen=len(Title) %> <% i=i+1 if i>=MaxPerPage then exit do rs2.MoveNext loop %>
" target="_blank" onMouseOver="showPopupText" alt="<%=rs2("ArticleTitle")%>"> <% if TitleLen>40 then %> <%=mid(Title,1,40)%> <% else %> <%=Title%> <% end if %> (<%=rs2("UpdateTime")%>)
<% 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 %>
<% if CurrentPage<2 then response.write "此类文章共"&totalnumber&"篇 首 页 上一页 " else response.write "此类文章共"&totalnumber&"篇 首 页 " response.write "上一页 " end if if n-currentpage<1 then response.write "下一页 尾 页" else response.write "下一页 " response.write "尾 页" end if response.write " 页次:"&CurrentPage&"/"&n&"页 " response.write " "&maxperpage&"篇文章/页 " %>
<% end function '================================================= set rs2=nothing conn.close set conn=nothing %>

 

  
  本站声明:马迪笛子艺术网站原创文章或首发文章,媒体或网友若需转载请通知本站同意,转载请保持文章完整性,并注明作者及文章来源。请勿擅自转载或编辑修改、挪作它用,否则追究相关责任。
 
     
版权所有©2009 马迪笛子艺术网站 设计:簪花吹雨