网络编程
位置:首页>> 网络编程>> Asp编程>> 自己用的ASP分页函数

自己用的ASP分页函数

作者:Rock 来源:asp之家 发布时间:2009-10-18 11:30:00 

标签:分页,函数

函数名:FenYe(url,pageCount,recordCount,curPage,cssstyle)        

功能:分页

参数:url当前页的网址;pageCount总页数; 

recordCount;总记录数;curPage当前页数; cssstyle连接的样式表 

示例:Call FenYe

("wangzhi.asp",rs.PageCount,rs.RecordCount,page,"class=''memu2''")  

Sub FenYe(url,pageCount,recordCount,curPage,cssstyle)
if url="" then Exit Sub
if inStr(url,"?")<>0 then
   if right(url,1)<>"?" then
    url=url&"&"
   end if 
else
   url=url&"?"
end if
if pagecount<=1 then exit sub
Response.Write "共"&recordCount &"条记录&nbsp;&nbsp;" & curPage & "/" & pageCount   & "页"
if curpage=1 then
   Response.Write "&nbsp;&nbsp;[首 页]&nbsp;&nbsp;[上 页]"
else
   Response.Write "&nbsp;&nbsp;<a "&cssstyle&" href=''"&url&"page=1''>[首 页]</a>&nbsp;&nbsp;<a "&cssstyle&" href=''"&url&"page="& curPage-1 &"''>[上 页]</a>"
end if
/>if Cint(curPage)=Cint(PageCount) then
   Response.Write "&nbsp;&nbsp;[下 页]&nbsp;&nbsp;[尾 页]"
else
   Response.Write "&nbsp;&nbsp;<a "&cssstyle&" href=''"&url&"page="& curPage+1 &"''>[下 页]</a>&nbsp;&nbsp;<a "&cssstyle&" href=''"&url&"page="& pageCount &"''>[尾 页]</a>"
end if
Response.Write "&nbsp;&nbsp;跳转到&nbsp;<select name=''select1'' size=''1'' onChange=''javascript:window.location.replace(this.options[this.selectedIndex].value)''>"
for i=1 to pageCount   
      Response.Write "<option" 
      If Cint(curPage) = i Then
         Response.Write " selected "
      End If
      Response.Write " value=''"&url&"page="&i&"''>第" & i & "页</option>"   
     next
Response.Write "</select>" 
End Sub

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com