推荐一种 Java的写法 :
另外几种asp的写法:
方法一:
<%
' HTMer_RecordCount为要计算的页面总数
' HTMer_RecordCount为记录集数
' HTMer_PageSize为每页记录数
If HTMer_RecordCount Mod HTMer_PageSize=0 Then ' 先 判断是否整除......
HTMer_PageCount=Int(HTMer_RecordCount/HTMer_PageSize)
Else
HTMer_PageCount=Int(HTMer_RecordCount/HTMer_PageSize)+1
End If
%>
' HTMer_RecordCount为要计算的页面总数
' HTMer_RecordCount为记录集数
' HTMer_PageSize为每页记录数
If HTMer_RecordCount Mod HTMer_PageSize=0 Then ' 先 判断是否整除......
HTMer_PageCount=Int(HTMer_RecordCount/HTMer_PageSize)
Else
HTMer_PageCount=Int(HTMer_RecordCount/HTMer_PageSize)+1
End If
%>
方法二:
<%
' HTMer_RecordCount为要计算的页面总数
' HTMer_RecordCount为记录集数
' HTMer_PageSize为每页记录数
HTMer_PageCount=Int(HTMer_RecordCount/HTMer_PageSize*-1)*-1 '没看明白这个*-是什么运算
%>
' HTMer_RecordCount为要计算的页面总数
' HTMer_RecordCount为记录集数
' HTMer_PageSize为每页记录数
HTMer_PageCount=Int(HTMer_RecordCount/HTMer_PageSize*-1)*-1 '没看明白这个*-是什么运算
%>
方法三:
<%
' HTMer_RecordCount为要计算的页面总数
' HTMer_RecordCount为记录集数
' HTMer_PageSize为每页记录数
HTMer_PageCount=Abs(Int(-(HTMer_RecordCount/HTMer_PageSize))) '怎样去利用负数来取到呢?
%>
' HTMer_RecordCount为要计算的页面总数
' HTMer_RecordCount为记录集数
' HTMer_PageSize为每页记录数
HTMer_PageCount=Abs(Int(-(HTMer_RecordCount/HTMer_PageSize))) '怎样去利用负数来取到呢?
%>
方法四:
<%
' HTMer_RecordCount为要计算的页面总数
' HTMer_RecordCount为记录集数
' HTMer_PageSize为每页记录数
HTMer_PageCount=Fix(HTMer_RecordCount/HTMer_PageSize)-CInt(CBool(HTMer_RecordCount Mod HTMer_PageSize)) '呵呵,还挺复杂的,主要是根据是否整除来计算,不太好 ,有vb的写法特性 %>
' HTMer_RecordCount为要计算的页面总数
' HTMer_RecordCount为记录集数
' HTMer_PageSize为每页记录数
HTMer_PageCount=Fix(HTMer_RecordCount/HTMer_PageSize)-CInt(CBool(HTMer_RecordCount Mod HTMer_PageSize)) '呵呵,还挺复杂的,主要是根据是否整除来计算,不太好 ,有vb的写法特性 %>