|
function ShowPage (sto,allpage,page) ' Displays the number of pages based on total pages and current pages
Dim first,last
Page=max (min (page,allpage), 1)
if (allpage>1) then
if (allpage>10) then
Response.Write "<a href= '" & Sto & "Page=1 ' ><<</a>"
End If
First=max (page-2,1)
First=min (Allpage-10,first)
if (allpage<=10) then
First=1
End If
Last=min (allpage,first+9)
For I=first to Last
If I=page Then
Response.Write "<b>[" & I & "]</b>"
Else
Response.Write "<a href= '" & Sto & "page=" & I & "' >[" & I & "]</a>"
End If
Next
If Allpage>1 Then
if (allpage>10) then
Response.Write "..."
Response.Write "<a href= '" & Sto & "page=" & Allpage & "' >"
Response.Write "[" & Allpage & "]"
Response.Write ">></a>"
End If
End If
End If
End Function
function min (num1,num2)
Min=num1
If Num2<min Then
Min=num2
End If
End Function
function Max (num1,num2)
Max=num1
If Num2>max Then
Max=num2
End If
End Function
'**************************************************
' Module: funtion showchildpage
' Function: Pagination
'**************************************************
function Showchildpage (sto,allpage,childpage) ' Displays the number of pages based on total pages and current pages
Dim first,last
Childpage=max (min (childpage,allpage), 1)
if (allpage>1) then
if (allpage>10) then
Response.Write "<a href= '" & Sto & "Childpage=1 ' ><<</a>"
End If
First=max (childpage-2,1)
First=min (Allpage-10,first)
if (allpage<=10) then
First=1
End If
Last=min (allpage,first+9)
For I=first to Last
If I=childpage Then
Response.Write "<b>[" & I & "]</b>"
Else
Response.Write "<a href= '" & Sto & "childpage=" & I & "' >[" & I & "]</a>"
End If
Next
If Allpage>1 Then
if (allpage>10) then
Response.Write "..."
Response.Write "<a href= '" & Sto & "childpage=" & Allpage & "' >"
Response.Write "[" & Allpage & "]"
Response.Write ">></a>"
End If
End If
End If
End Function
|