手机
当前位置:查字典教程网 >编程开发 >ASP教程 >ShowPage 显示“上一页 下一页”等信息的封装代码
ShowPage 显示“上一页 下一页”等信息的封装代码
摘要:'**************************************************'函数名:ShowPage'作用:显示...

'**************************************************

'函数名:ShowPage

'作用:显示“上一页下一页”等信息

'参数:sFileName----链接地址

'TotalNumber----总数量

'MaxPerPage----每页数量

'ShowTotal----是否显示总数量

'ShowAllPages---是否用下拉列表显示所有页面以供跳转。有某些页面不能使用,否则会出现JS错误。

'strUnit----计数单位

'返回值:“上一页下一页”等信息的HTML代码

'**************************************************

functionShowPage(sFileName,TotalNumber,MaxPerPage,ShowTotal,ShowAllPages,strUnit)

dimTotalPage,strTemp,strUrl,i

ifTotalNumber=0orMaxPerPage=0orisNull(MaxPerPage)then

ShowPage=""

exitfunction

endif

iftotalnumbermodmaxperpage=0then

TotalPage=totalnumbermaxperpage

Else

TotalPage=totalnumbermaxperpage+1

endif

ifCurrentPage>TotalPagethenCurrentPage=TotalPage

strTemp="<tablealign='center'><tr><td>"

ifShowTotal=truethen

strTemp=strTemp&"共<b>"&totalnumber&"</b>"&strUnit&""

endif

strUrl=JoinChar(sfilename)

ifCurrentPage<2then

strTemp=strTemp&"首页上一页"

Else

strTemp=strTemp&"<ahref='"&strUrl&"page=1'>首页</a>"

strTemp=strTemp&"<ahref='"&strUrl&"page="&(CurrentPage-1)&"'>上一页</a>"

endif

ifCurrentPage>=TotalPagethen

strTemp=strTemp&"下一页尾页"

Else

strTemp=strTemp&"<ahref='"&strUrl&"page="&(CurrentPage+1)&"'>下一页</a>"

strTemp=strTemp&"<ahref='"&strUrl&"page="&TotalPage&"'>尾页</a>"

endif

strTemp=strTemp&"页次:<strong><fontcolor=red>"&CurrentPage&"</font>/"&TotalPage&"</strong>页"

strTemp=strTemp&"<b>"&maxperpage&"</b>"&strUnit&"/页"

ifShowAllPages=Truethen

strTemp=strTemp&"转到第<inputtype='text'name='page'size='3'maxlength='5'value='"&CurrentPage&"'onKeyPress=""if(event.keyCode==13)window.location='"&strUrl&"page="&"'+this.value;""'>页"

'strTemp=strTemp&"<Inputtype=""button""onClick=""window.location.href='"&strUrl&"page='+document.all.page.value;""name=button1value=GO>"

endif

strTemp=strTemp&"</td></tr></table>"

ShowPage=strTemp

endfunction

【ShowPage 显示“上一页 下一页”等信息的封装代码】相关文章:

ASP编程常用的代码

ASP整理一些实用的速查代码

蓝色空间 天气小偷

简单过滤一下广告的代码

一些值得一看的代码asp

ASP中有关双引号,单引号以及&号的解释

ASP连接数据库的全能代码

asp中COM组件中如何连接数据库的代码

一个ASP中的数组

上一篇,下一篇过程代码

精品推荐
分类导航