function showpage(sto,allpage,page) '根据总页数与当前页数显示页数
dim first,last
page=max(min(page,allpage),1)
if (allpage>1) then
if (allpage>10) then
response.write "<<"
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 "[" & i & "]"
else
response.write"[" & i & "]"
end if
next
if allpage>1 then
if (allpage>10) then
response.write "…"
response.write ""
response.write "[" & allpage & "]"
response.write ">>"
end if
end if
end if
end function
function min(num1,num2)
min=num1
if num2
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 "<<"
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 "[" & i & "]"
else
response.write"[" & i & "]"
end if
next
if allpage>1 then
if (allpage>10) then
response.write "…"
response.write ""
response.write "[" & allpage & "]"
response.write ">>"
end if
end if
end if
end function
|