Sub ShowPageBar(TotalPage,CurPage,ipagesize,irecordcount,strUrl)
''参数TotalPage:整个页数
''参数CurPage:当前页数
''ipagesize:每页显示记录数
''irecordcount:记录总数
''参数strUrl:翻页使用的连接地址
'==============================计算显示参数======================
DIM strPage,currecordcount,page_start,page_end
if curpage+1>totalpage then '计算当前显示条数
currecordcount=irecordcount-ipagesize*(curpage-1)
else
currecordcount=ipagesize*curpage
end if
if totalpage=1 then '计算开始和结束记录
page_start=1
page_end=irecordcount
else
page_start=(curpage-1)*ipagesize+1
if curpage=1 then page_start=1 end if
page_end=ipagesize*curpage
if curpage*ipagesize=>irecordcount then page_end=irecordcount end if
end if
'==============================导航条开始=======================
CurPage=GetValidPageNO(TotalPage,CurPage)
Response.Write "<TABLE WIDTH=''100%''>"
Response.Write "<TR><td width=''80%'' align=''right''><font size=2>"
Response.Write "共<font color=red>" & irecordcount & "</font>条 <font color=red>" & ipagesize & "</font>条/页 共<font color=red>" & TotalPage & "</font>页 "
if CInt(inStr(strUrl,"?"))=0 then
strPage="?Page="
else
strPage="&Page="
end if
IF Curpage>1 THEN
Response.Write "<a href=" &strUrl&strPage&"1>首页</a> "
ELSE
Response.Write "首页 "
END IF
IF CurPage>=2 THEN
Response.Write "<a href=" & strUrl &strPage&CurPage-1&">上页</a> "
ELSE
Response.Write "上页 "
END IF
IF cInt(CurPage)<cInt(TotalPage) THEN
Response.Write "<a href=" & strUrl &strPage&CurPage+1&">下页</a> "
ELSE
Response.Write "下页 "
END IF
IF cInt(CurPage) <>cInt(TotalPage) THEN
'if len(totalpage)<>0 then
Response.Write "<a href=" &strUrl&strPage&TotalPage&">末页</a> "
'end if
ELSE
Response.Write "末页"
END IF
Response.Write " 第</font></td><td width=''20%''><font size=2> "
Response.Write "<select name=pageno1 onchange=window.open('"&strUrl&strPage&"'+this.options[this.selectedIndex].value,'_self') style='font-size: 9pt; color:#00006A; position: relative; height: 16'>"
dim i
for i=1 to cint(totalpage)
if i=cint(curpage) then
Response.Write "<option value="&i&" selected>"&i&"</option>"
else
Response.Write "<option value="&i&">"&i&"</option>"
end if
next
Response.Write "</select>页 </font></td></tr></table>"
'==============================导航条结束=======================
END SUB
Function GetValidPageNo(PageCount,CurPage)
Dim iPage
iPage=CurPage
IF cInt(CurPage)<1 THEN
iPage= 1
END IF
IF cInt(iPage)>cInt(PageCount) THEN
iPage=1
END IF
GetValidPageNo=iPage
END Function
%>