function MouseAppList(pageNoArea) { var self = this; this.pageNoArea = pageNoArea; // console.log(parent); } MouseAppList.prototype.addPlayerListPages = function(playerCount) { lastPageNo = Math.ceil( (playerCount + 1) / 10 ); $(this.pageNoArea).empty(); for(var pageNo = 1; pageNo < lastPageNo + 1; pageNo++) { $(this.pageNoArea).append( " " + pageNo + " " ); } } function onClickPlayerListPage(pageNo) { switch(pageNo) { case "first": playerListPage = 1; loadPlayerListPage(playerListPage); return; case "prev": if(playerListPage > 1) playerListPage -= 1; loadPlayerListPage(playerListPage); return; case "next": if(playerListPage < lastPageNo) playerListPage += 1; loadPlayerListPage(playerListPage); return; case "last": loadPlayerListPage(lastPageNo); return; } loadPlayerListPage(pageNo); }