分頁代碼

Sub Pagination(link,maxpage,pageindex,pagsize,maxrscount,pagisize)
 Response.Write("第<strong>"&pageindex&"</strong>頁 共<strong>"&maxpage&"</strong>頁 <strong>"&pagsize&"</strong>條/頁 共<strong>"&maxrscount&"</strong>條 ")
 Dim tenPage,fir,las
 if maxpage < pagisize Then
  For i = 1 to pagisize
   if i + 1 = pageindex + 1 then
    response.Write("<a href=?page="&I&Link&"><span style=color:red;font-weight:bold;>["&I&"]</span></a> "&vbCrlf)   
   else
    response.Write("<a href=?page="&I&Link&">["&I&"]</a> "&vbCrlf)
   end if
   If I >= maxpage Then Exit For End If
  Next
 Else
  tenPage = int(pageindex/pagisize)
  If pageindex mod pagisize = 0 then
   fir = (tenpage - 1)*pagisize + 1
   las = tenpage * pagisize
  Else
   fir = tenpage * pagisize + 1
   las = (tenPage + 1) * pagisize
  End If
  If las > maxpage Then las = maxpage End If
  If pageindex - 1 > 0 Then response.Write("<a href=?page=1"&Link&">首頁</a> "&vbCrlf) End If
  If pageindex - pagisize > 0 Then response.Write("<a href=?page="&fir - 1&Link&">前十頁</a> "&vbCrlf) End If
  For i = fir to las
   if i + 1 = pageindex + 1 then
    response.Write("<a href=?page="&I&Link&"><span style=color:red;font-weight:bold;>["&I&"]</span></a> "&vbCrlf)
   else
    response.Write("<a href=?page="&I&Link&">["&I&"]</a> "&vbCrlf)
   end if
   
  Next
  If maxpage - pageindex > pagisize Then response.Write("<a href=?page="&las + 1&Link&">後十頁</a> "&vbCrlf) End If
  If maxpage - pageindex > pagisize Then response.Write("<a href=?page="&maxpage&Link&">尾頁</a> "&vbCrlf) End If
 End If
End Sub
 
答疑解惑:
1.如何賦值
2.如何調用
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章