コードコピーは次のとおりです。
(function($){
$ .fn.tablePage = function(oobj、dcountofpage、fresh_id){
var dpageIndex = 1;
var dnowindex = 1;
var spagestr = "";
var dcount = 0;
var osource = $(this);
var snoselcolor = "#cccccc";
var sselcolor = "black";
var sfontcolor = "white";
var nowindex = 1;
change_page_content();
function change_page_content(){
//材料を取得します
dcount = osource.children()。children()。length;
// 見せる
spagestr = "<div class = 'ref'> <a href = 'javascript:void(0)' id = 'fresh_"
+ fresh_id
+ "'onclick =' fresh(this.id); 'class =' style = 'color:#247aa9;'> <span> refresh </span> </a> </div>";
SPAGESTR += "<div class = 'msdn'> <a href = 'javascript:void(0)'> home </a> <a href = 'javascript:void(0)'>前のページ</a> < a href = 'javascript:void(0)'>次ページ</a> <a href = 'javascript:void(0)'>最後のページ</a> </div> ";
SPAGESTR+= "<div class = 'txt'>"+"total"+math.ceil(dcount / dcountofpage)+"page、現在"+"<strong>"+dnowindex+"< / strong>"+"page "+" </div> ";
oobj.html(spagestr);
dPageIndex = 1;
//テーブルコンテンツ
var rr = osource.children()。子供( "tr");
osource.children()。子供( "tr")。各(function(){{
// == 2
if(dpageindex> =(((dnowindex -1) * dcountofpage) + 1)
&& dpageIndex <=((dnowindex * dcountofpage))){
$(this).show();
} それ以外 {
$(this).hide();
}
dPageIndex ++;
});
//osource.children()。first()。show();
if(dcount <= dcountofpage){
var tt = $( "#table_page _"+fresh_id)。
if(i == 2 || i == 3 || i == 0 || i == 1){
$(this).addclass( "disabled");
}
});
}
else if(dnowindex == math.ceil(dcount / dcountofpage)){
var tt = $( "#table_page _"+fresh_id)。
if(i == 2 || i == 3){
$(this).addclass( "disabled");
}
});
} else if(dnowindex == 1){
var tt = $( "#table_page _"+fresh_id)。
if(i == 0 || i == 1){
$(this).addclass( "disabled");
}
});
}
//イベントに参加します
oobj.children()。children()。各(function(){
$(this).click(function(){
dnowindex = $(this)[0] .innerhtml;
if(dnowindex == 'home'){
dnowindex = 1;
change_page_content();
nowindex = dnowindex;
}
if(dnowindex == 'last page'){
dnowindex = math.ceil(dcount / dcountofpage);
change_page_content();
nowindex = dnowindex;
}
if(dnowindex == 'Next Page'){
if(nowindex <math.ceil(dcount / dcountofpage)){
dnowindex = parseint(nowindex) + 1;
change_page_content();
nowindex = nowindex + 1;
}
}
if(dnowindex == '前のページ'){
if(nowindex> 1){
dnowindex = parseint(nowindex)-1;
change_page_content();
nowindex = nowindex -1;
}
}
});
});
}
};
})(jQuery);
コードコピーは次のとおりです。
<script type = "text/javascript">
$(document).ready(function(){
var totalpage = $( "ul li")。長さ;
var total = math.ceil($( "ul li")。長さ / 5);
var current = 1;
// var index = 4;
if(totalpage> 5){
$( "ul li:gt(4)")。hide();
$( "#btnprev")。
デバッガ;
$( "#btnnext")。
$( "#btnnext")。removeattr( "disabled");
現在 - = 1;
var tt = current;
$( "ul li")。show();
var indexstart =(current -1);
var indexend = indexstart + 4;
$( "li:lt(" + indexstart + ")、li:gt(" + indexend + ")"、$( "ul"))。hide();
if(current == 1){
$(this).attr( "class"、 "tabs-scroller-left-disabled");
$(this).attr( "disabled"、 "disabled");
}
});
$( "#btnnext")。クリック(function(){
デバッガ;
$( "#btnprev")。
$( "#btnprev")。removeattr( "disabled");
現在の += 1;
$( "ul li")。show();
var indexstart =(current -1);
var indexend = current + 4> $( "ul li")。長さ-1( "ul li")。
$( "li:lt(" + indexstart + ")、li:gt(" + indexend + ")"、$( "ul"))。hide();
if(current+4> = totalPage){
$(this).attr( "class"、 "tabs-scroller-right-disabled");
$(this).attr( "disabled"、 "disabled");
}
});
}それ以外{
アラート(1);
$( "#btnprev")。
$( "#btnnext")。
}
});
</script>