js实现ASP分页函数 HTML分页函数

2016-02-19 11:59 6 1 收藏

关注图老师设计创意栏目可以让大家能更好的了解电脑,知道有关于电脑的更多有趣教程,今天给大家分享js实现ASP分页函数 HTML分页函数教程,希望对大家能有一点小小的帮助。

【 tulaoshi.com - Web开发 】

代码如下:

!--
//ASP分页函数
function ShowListPage(page,Pcount,TopicNum,maxperpage,strLink,ListName){
    var alertcolor = '#FF0000';
    maxperpage=Math.floor(maxperpage);
    TopicNum=Math.floor(TopicNum);
    page=Math.floor(page);
    var n,p;
    if ((page-1)%10==0) {
        p=(page-1) /10
    }else{
        p=(((page-1)-(page-1)%10)/10)
    }
    if(TopicNum%maxperpage==0) {
        n=TopicNum/maxperpage;
    }else{
        n=(TopicNum-TopicNum%maxperpage)/maxperpage+1;
    }
    document.write ('table border="0" cellpadding="0" cellspacing="1" class="Tableborder5"');
    document.write ('form method=post action="?pcount='+Pcount+strLink+'"');
    document.write ('tr align="center"');
    document.write ('td class="tabletitle1" title="'+ListName+'" '+ListName+' /td');
    document.write ('td class="tabletitle1" title="总数" '+TopicNum+' /td');
    document.write ('td class="tabletitle1" title="每页" '+maxperpage+' /td');
    document.write ('td class="tabletitle1" title="页次" '+page+'/'+Pcount+'页 /td');
    if (page==1){
        document.write ('td class="tablebody1" font face=webdings9/font /td');
    }else{
        document.write ('td class="tablebody1" a href="?page=1'+strLink+'" title="首页"font face=webdings9/font/a /td');
    }
    if (p*10  0){
        document.write ('td class="tablebody1" a href="?page='+p*10+strLink+'" title="上十页"font face=webdings7/font/a /td');
    }
    if (page  2){
        document.write ('td class="tablebody1" 首 页 /td');
        document.write ('td class="tablebody1" 上一页 /td');
    }else{
        document.write ('td class="tablebody1" a href="?page=1'+strLink+'" title="首页"首 页/a /td');
        document.write ('td class="tablebody1" a href="?page='+(page-1)+strLink+'" title="上一页"上一页/a /td');
    }
    if (Pcount-page  1){
        document.write ('td class="tablebody1" 下一页 /td');
        document.write ('td class="tablebody1" 尾 页 /td');
    }else{
        document.write ('td class="tablebody1" a href="?page='+(page+1)+strLink+'" title="下一页"下一页/a /td');
        document.write ('td class="tablebody1" a href="?page='+Pcount+strLink+'" title="尾页"尾 页/a /td');
    }
    for (var i=p*10+1;ip*10+11;i++){
        if (i==n) break;
    }
    if (in){
        document.write ('td class="tablebody1" a href="?page='+i+strLink+'" title="下十页"font face=webdings8/font/a td');
    }
    if (page==n){
        document.write ('td class="tablebody1" Font face=webdings:/font /td');
    }else{
        document.write ('td class="tablebody1" a href="?page='+n+strLink+'" title="尾页"font face=webdings:/font/a /td');
    }
    document.write ('td class="tablebody1"input class="PageInput" type=text name="page" size=1 maxlength=10  value="'+page+'"/td');
    document.write ('td class="tablebody1"input type=submit value=Go name=submit class="PageInput"/td');
    document.write ('/tr');
    document.write ('/form/table');
}
//HTML分页函数
function ShowHtmlPage(page,Pcount,TopicNum,maxperpage,strLink,ExtName,ListName){
    var alertcolor = '#FF0000';
    maxperpage=Math.floor(maxperpage);
    TopicNum=Math.floor(TopicNum);
    page=Math.floor(page);
    var n,p;
    if ((page-1)%10==0) {
        p=(page-1) /10
    }else{
        p=(((page-1)-(page-1)%10)/10)
    }
    if(TopicNum%maxperpage==0) {
        n=TopicNum/maxperpage;
    }else{
        n=(TopicNum-TopicNum%maxperpage)/maxperpage+1;
    }
    document.write ('table border="0" cellpadding="0" cellspacing="1" class="Tableborder5"');
    document.write ('form method=post');
    document.write ('tr align="center"');
    document.write ('td class="tabletitle1" title="'+ListName+'" '+ListName+' /td');
    document.write ('td class="tabletitle1" title="总数" '+TopicNum+' /td');
    document.write ('td class="tabletitle1" title="每页" '+maxperpage+' /td');
    document.write ('td class="tabletitle1" title="页次" '+page+'/'+Pcount+'页 /td');
    if (page==1){
        document.write ('td class="tablebody1" font face=webdings9/font /td');
    }else{
        document.write ('td class="tablebody1" a href="index'+ExtName+'" title="首页"font face=webdings9/font/a /td');
    }
    if (p*10  0){
        document.write ('td class="tablebody1" a href="'+strLink+(p*10)+ExtName+'" title="上十页"font face=webdings7/font/a /td');
    }
    if (page  3){
        document.write ('td class="tablebody1" 首 页 /td');
        document.write ('td class="tablebody1" a href="index'+ExtName+'" title="上一页"上一页1/a /td');
    }else{
        document.write ('td class="tablebody1" a href="index'+ExtName+'" title="首页"首 页1/a /td');
        document.write ('td class="tablebody1" a href="'+strLink+(page-1)+ExtName+'" title="上一页"上一页/a /td');
    }
    if (Pcount-page  1){
        document.write ('td class="tablebody1" 下一页1 /td');
        document.write ('td class="tablebody1" 尾 页 /td');
    }else{
        document.write ('td class="tablebody1" a href="'+strLink+(page+1)+ExtName+'" title="下一页"下一页/a /td');
        document.write ('td class="tablebody1" a href="'+strLink+Pcount+ExtName+'" title="尾页"尾 页/a /td');
    }
    for (var i=p*10+1;ip*10+11;i++){
        if (i==n) break;
    }
    if (in){
        document.write ('td class="tablebody1" a href="'+strLink+i+ExtName+'" title="下十页"font face=webdings8/font/a td');
    }
    if (page==n){
        document.write ('td class="tablebody1" Font face=webdings:/font /td');
    }else{
        document.write ('td class="tablebody1" a href="'+strLink+n+ExtName+'" title="尾页"font face=webdings:/font/a /td');
    }
    //document.write ('td class="tabletitle1" title="转到" GO /td');
    document.write ('td class="tablebody1"select class="PageInput" name="page" size="1" onchange="javascript:window.location=this.options[this.selectedIndex].value;"');
    document.write ('option value="index'+ExtName+'"第1页/option');
    for (var i=2;iTopicNum;i++){
        if (i==page){
            document.write ('option value="'+strLink+i+ExtName+'" selected第'+i+'页/option');
        }else{
            if (i==1){
                document.write ('option value="index'+ExtName+'"第1页/option');
            }else{
                document.write ('option value="'+strLink+i+ExtName+'"第'+i+'页/option');
            }
        }
        if (i==n) break;
    }
    document.write ('/select/td');
    document.write ('/tr');
    document.write ('/form/table');
}
//--

来源:https://www.tulaoshi.com/n/20160219/1599403.html

延伸阅读
标签: Web开发
代码如下: 本人原创的代码,高手看来,也许流程笨拙点,但是很实用.看者要顶啊     /*---------------------------------------------------------------//   * 函数说明:分页函数 page($sql,$pagesize="30")   * $sql 查询语句(除limit外,可带排序或者条件限制)  &nbs...
标签: ASP
一、创建表 tiku_koushi if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tiku_koushi]') and OBJECTPROPERTY (id, N'IsUserTable') = 1) drop table [dbo].[tiku_koushi] GO CREATE TABLE [dbo].[tiku_koushi] ( [id] [int] IDENTITY (1, 1) NOT NULL , [title] [varchar] (250) COLLATE Chinese_PRC_CI_AS N...
标签: ASP
  注意事项: ※本文代码可能有一些多余部分未去掉,请在阅读时忽略。   一些外部include进来的文件这里就不贴上来了。 ※小乙写xsl也不久,很多语句都不会使用,有些地方写得比较罗嗦,   如果您有更好的分页代码,请多多拿来交流。 ※适用于:用asp load进来xml代码,然后用此xsl文件进行分页处理。 ※[2001.2.19] ...
标签: Web开发
'//判断内容里是不是包含这个分页标签 if instr(cinfo,"[NextPage]")0 then flag=1 else flag=0 end if '//设置参数 script language="Javascript" var Text,PageSize,flag Text="%=DealJsText(cinfo)%"; PageSize=1500; flag=%=flag%; /script '//JS文件包函 script language="Javascript" src="CutArticle.js"/script '//文本显示 span...
标签: Web开发
作者:bencalie 整理日期:2004年6月15日 user 1 name 1 user 2 name 2 user 3 name 3 user 4 name 4 user 5 name 5 user 6 name 7 user 7 name 7 user 8 name 8 user 9 name 9 Previous Page Next Page [C...

经验教程

436

收藏

36
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部