function showpage(sto,allpage,page) '根据总页数与当前页数显示页数
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
'**************************************************
'模 块:funtion showchildpage
'作 用:分页
'**************************************************
function showchildpage(sto,allpage,childpage) '根据总页数与当前页数显示页数
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
|