'**************************************************
'函数名:ShowPage
'作 用:显示“上一页 下一页”等信息
'参 数:sFileName ----链接地址
' TotalNumber ----总数量
' MaxPerPage ----每页数量
' CurrentPage ----当前页
' ShowTotal ----是否显示总数量
' ShowAllPages ---是否用下拉列表显示所有页面以供跳转。
' strUnit ----计数单位
' ShowMaxPerPage ----是否显示每页信息量选项框
'返回值:“上一页 下一页”等信息的HTML代码
'**************************************************
Function ShowPage(sfilename, totalnumber, MaxPerPage, CurrentPage, ShowTotal, ShowAllPages, strUnit, ShowMaxPerPage)
Dim TotalPage, strTemp, strUrl, i
If totalnumber = 0 Or MaxPerPage = 0 Or IsNull(MaxPerPage) Then
ShowPage = ""
Exit Function
End If
If totalnumber Mod MaxPerPage = 0 Then
TotalPage = totalnumber \ MaxPerPage
Else
TotalPage = totalnumber \ MaxPerPage + 1
End If
If CurrentPage > TotalPage Then CurrentPage = TotalPage
strTemp = "<div class=""show_page"">"
If ShowTotal = True Then
strTemp = strTemp & "共 <b>" & totalnumber & "</b> " & strUnit & " "
End If
If ShowMaxPerPage = True Then
strUrl = JoinChar(sfilename) & "MaxPerPage=" & MaxPerPage & "&"
Else
strUrl = JoinChar(sfilename)
End If
If CurrentPage = 1 Then
strTemp = strTemp & "首页 上一页 "
Else
strTemp = strTemp & "<a href='" & strUrl & "page=1'>首页</a> "
strTemp = strTemp & "<a href='" & strUrl & "page=" & (CurrentPage - 1) & "'>上一页</a> "
End If
If CurrentPage >= TotalPage Then
strTemp = strTemp & "下一页 尾页"
Else
strTemp = strTemp & "<a href='" & strUrl & "page=" & (CurrentPage + 1) & "'>下一页</a> "
strTemp = strTemp & "<a href='" & strUrl & "page=" & TotalPage & "'>尾页</a>"
End If
strTemp = strTemp & " 页次:<strong><font color=red>" & CurrentPage & "</font>/" & TotalPage & "</strong>页 "
If ShowMaxPerPage = True Then
strTemp = strTemp & " <Input type='text' name='MaxPerPage' size='3' maxlength='4' value='" & MaxPerPage & "' onKeyPress=""if (event.keyCode==13) window.location='" & JoinChar(sfilename) & "page=" & CurrentPage & "&MaxPerPage=" & "'+this.value;"">" & strUnit & "/页"
Else
strTemp = strTemp & " <b>" & MaxPerPage & "</b>" & strUnit & "/页"
End If
If ShowAllPages = True Then
If TotalPage > 20 Then
strTemp = strTemp & " 转到第<Input type='text' name='page' size='3' maxlength='5' value='" & CurrentPage & "' onKeyPress=""if (event.keyCode==13) window.location='" & strUrl & "page=" & "'+this.value;"">页"
Else
strTemp = strTemp & " 转到:<select name='page' size='1' onchange=""javascript:window.location='" & strUrl & "page=" & "'+this.options[this.selectedIndex].value;"">"
For i = 1 To TotalPage
strTemp = strTemp & "<option value='" & i & "'"
If PE_CLng(CurrentPage) = PE_CLng(i) Then strTemp = strTemp & " selected "
strTemp = strTemp & ">第" & i & "页</option>"
Next
strTemp = strTemp & "</select>"
End If
End If
strTemp = strTemp & "</div>"
ShowPage = strTemp
End Function
PowerEasy SiteWeaver里找到的