无标题文章

function pageAjax (pageNum) {            var arr = selecPage();            var html = '';            var n = pageNum - 1;            arr.forEach(function(v,i){                if(n == i){                    html += v;                }            })            $("#box").html(html);        }        pageAjax(1)        var Page = (function(){            var Page = function(obj){                return fn.init(obj);            }            var fn = Page.prototype = {                init:function(obj){                    this.pageCount = obj.pageCount;                    this.pageSize = obj.pageSize || 7;                    this.pageNow = obj.pageNow || 1;                    this.containerId = obj.id;                    this.container = document.getElementById(this.containerId);                    fn.drawPage();                    return this;                },                drawPage:function(){                    this.container.innerHTML = "";                    var front = document.createElement("a");                    var next = document.createElement("a");                    this.acontainer = document.createElement("sapn");                    front.innerHTML = "<";                    next.innerHTML = ">";                    front.className = "front";                    next.className = "next";                    this.container.appendChild(front);                    $(front).on("click",function(){                        fn.frontOrNext(this,true);                        fn.inputBox.value = fn.pageNow;                    })                    $(next).on("click",function(){                        fn.frontOrNext(this,false);                        fn.inputBox.value = fn.pageNow;                    })                    this.front = front;                    this.next = next;                    if(this.pageCount<= this.pageSize){                        for( var i=0;i=fn.pageSize-1){

fn.reset();

}

etc2.className = "etc";

fn.inputBox.value = this.innerHTML;

})

this.acontainer.appendChild(a);

if(i+1 == this.pageNow){

a.className = "select";

}

}

fn.check();

this.acontainer.appendChild(etc2);

fn.pageN()

}else{

fn.reset();

}

}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • function selecPage () { var n = 0; $.ajax({ url:"data.jso...
    BJ小哇阅读 3,793评论 0 0
  • var jumpContainer = document.createElement("span"); ...
    BJ小哇阅读 1,657评论 0 0
  • 单例模式 适用场景:可能会在场景中使用到对象,但只有一个实例,加载时并不主动创建,需要时才创建 最常见的单例模式,...
    Obeing阅读 6,367评论 1 10
  • 工厂模式类似于现实生活中的工厂可以产生大量相似的商品,去做同样的事情,实现同样的效果;这时候需要使用工厂模式。简单...
    舟渔行舟阅读 12,378评论 2 17
  • # tween.js user guide _**NOTE** this is a work in progres...
    3216732c1db1阅读 3,097评论 0 0