코드 사본은 다음과 같습니다.
(기능 ($) {
$ .fn.tablePage = function (oobj, dcountofpage, fresh_id) {
var dpageindex = 1;
var dnowindex = 1;
var spagest = "";
var dcount = 0;
var osource = $ (this);
var snoselcolor = "#CCCCCC";
var sselcolor = "black";
var sfontcolor = "화이트";
var nowindex = 1;
change_page_content ();
함수 change_page_content () {
// 자료를 얻습니다
dcount = osource.children (). children (). 길이;
// 보여주다
spagest = "<div class = 'ref'> <a href = 'javaScript : void (0)'id = 'frush_"
+ fresh_id
+ "onclick = 'fresh (this.id);'sx 'style ='색상 :#247aa9; '> <span> refresh> </a> </div>";
spagest += "<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> ";
Spagest+= "<div class = 'txt'>"+"Total"+Math.ceil (dcount / dcountofpage)+"page, 현재"+"<strong>"+dnowindex+"< / strong>"+"페이지 "+"</div> ";
oobj.html (Spagest);
dpageindex = 1;
// 테이블 내용
var rr = osource.children (). children ( "tr");
osource.children (). children ( "tr"). 각 (function () {
// == 2
if (dpageIndex> = (((dnowindex -1) * dcountofpage) + 1)
&& dpageIndex <= ((dnowindex * dcountofpage))) {
$ (this) .show ();
} 또 다른 {
$ (this) .hide ();
}
dpageindex ++;
});
//osource.children (). children ( "tr"). first ()
if (dcount <= dcountofpage) {
var tt = $ ( "#table_page _"+fresh_id) .children ( '. msdn'). children (). 각 (함수 (i) {
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) .children ( '. msdn'). children (). 각 (함수 (i) {
if (i == 2 || i == 3) {
$ (this) .addclass ( "disabled");
}
});
} else if (dnowindex == 1) {
var tt = $ ( "#table_page _"+fresh_id) .children ( '. msdn'). children (). 각 (함수 (i) {
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 == 'previous page') {
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"). length / 5);
var current = 1;
// var index = 4;
if (TotalPage> 5) {
$ ( "ul li : gt (4)"). hide ();
$ ( "##btnprev"). att
디버거;
$ ( "#btnnext"). attr ( "class", "tabs-scroller-right");
$ ( "#btnnext"). removeattr ( "disabled");
현재 -= 1;
var tt = current;
$ ( "ul li"). show ();
var indexstart = (현재 -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"). attr ( "class", "tabs-scroller-left");
$ ( "#btnprev"). removeAttr ( "disabled");
현재 += 1;
$ ( "ul li"). show ();
var indexstart = (현재 -1);
var indexend = current + 4> $ ( "ul li"). 길이 -1 ( "ul li").
$ ( "li : lt (" + indexstart + "), li : gt (" + indexend + ")", $ ( "ul"). hide ();
if (현재+4> = TotalPage) {
$ (this) .attr ( "class", "tabs-scroller-rightisabled");
$ (this) .attr ( "disabled", "disabled");
}
});
}또 다른{
경고 (1);
$ ( "#btnprev"). attr ( "class", "tabs-scroller-left-disabled");
$ ( "#btnnext"). attr ( "class", "tabs-scroller-right-disabled");
}
});
</스크립트>