我有一个静态页面html,
里面有1000多条记录,怎么用js来静态分页呢?

解决方案 »

  1.   

    //客户端分页
    var currPage = 1;
    var page = {
        ListBody:function(){
            var obj = null;
            if($("listBody") != null)
            {
                obj = $("listBody");
            }
            else
            {
                obj = $("big_listBody");
            }
            if(obj == null)
            {
                obj = $("fff");
            }
            return obj;
        },
        disPage:function(){
            for(var i=0;i<this.ListBody().childNodes.length-1;i++)
            {
                this.ListBody().childNodes(i).style.display = "none";
            }
        },
        tab:function(cmd){
            if(cmd == "pers")
            {
               if(currPage > 1)
               {
                   this.disPage();
                   $("list"+(currPage-1)).style.display = "";
                   currPage--;
               }
            }
            else if(cmd == "next")
            {
               if(currPage < this.ListBody().childNodes.length -1)
               {
                   this.disPage();
                   $("list"+(currPage+1)).style.display = "";
                   currPage++;
               }
            }
            $("next").disabled = true;
            $("pers").disabled = true;
            if(currPage < this.ListBody().childNodes.length -1)
            {
                $("next").disabled = false;
            }
            if(currPage > 1)
            {
                $("pers").disabled = false;
            }
            $("currCount").innerText = currPage;
        }
    };
      

  2.   

    你这是php代码吗?我要用的是html的分页