<div><img src="/static/imghwm/default1.png" data-src="http://files.jb51.net/upload/201103/20110320232752663.bmp?x-oss-process=image/resize,p_40" class="lazy" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" this.src)' alt="" onload="if(this.width>650) this. style="max-width:90%" border="0"></div> <div> </div> <div><img src="/static/imghwm/default1.png" data-src="http://files.jb51.net/upload/201103/20110320232753596.bmp?x-oss-process=image/resize,p_40" class="lazy" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" this.src)' alt="" onload="if(this.width>650) this. style="max-width:90%" border="0"></div> <div> </div> <div> </div> <div>コードは非常に簡単です。添付ファイルにあるので、ダウンロードして直接実行できます。<br><div class="codetitle"> <span><a style="CURSOR: pointer" data="90203" class="copybut" id="copybut90203" onclick="doCopy('code90203')"><u>コードをコピーします</u></a></span>コードは次のとおりです。</div> <div class="codebody" id="code90203"> <br><script type="text/javascript" language="javascript"> <BR>$(function() { <BR>jQuery.fn.alternateRowColors = function () { //プラグインにします。フォーム<BR>$('tbody tr:odd', this).removeClass('even').addClass('odd'); //奇数行は 1 行おきに色を変更します。 row<BR>$('tbody tr:even', this ).removeClass('odd').addClass('even'); //偶数行は 1 行おきに色を変更します<BR>return this>}; <BR>$('table.myTable').each(function() { <BR>var $table = $(this); //jquery オブジェクトとしてのストレージ テーブル<BR>$table.alternateRowColors($table); //ソート時に代替行の色が変わります<BR>$('th', $table).each(function(column) { <BR>var findSortKey; <BR>if ($(this).is('.sort- alpha')) { //アルファベット順に並べ替えます<BR>findSortKey = function( $cell) { <BR>return $cell.find('sort-key').text().toUpperCase() '' $cell.text( ).toUpperCase(); <BR>}; <BR>} else if ($(this).is('.sort-numeric')) { //数値的に並べ替えます<BR>findSortKey = function($cell) { <BR>var key = parseFloat($cell.text().replace (/^[^d.]*/, '')); <BR>return isNaN(key) ? <BR>}; 🎜>} else if ($(this).is('.sort-date')) { //日付で並べ替えます<BR>findSortKey = function($cell) { <BR>return Date.parse('1 ' $ cell.text()); <BR>}; <BR> } <BR>if (findSortKey) { <BR>$(this).addClass('clickable').hover(function() { $(this). addClass('hover'); }, function() { $(this).removeClass('hover'); }).click(function() { <BR>//逆ソートステータスステートメント<BR>var newDirection = 1 ; <BR>if ($(this).is(' .sorted-asc')) { <BR>newDirection = -1; <BR>} <BR>var rows = $table.find('tbody>tr' ).get(); //データ行を配列に変換します <BR>$.each(rows, function(index, row) { <BR>row.sortKey = findSortKey($(row).children('td'). eq(column)); <BR>}); <BR>rows.sort(function(a, b) { <BR>if (a.sortKey < b.sortKey) return -newDirection; <BR>if (a .sortKey > b.sortKey) return newDirection <BR>return <BR>}); <BR>$.each(rows, function(index, row) { <BR>$table.children('tbody') ).append(row); <BR>row.sortKey = null <BR>$table.find('th').removeClass('sorted-desc'); '); <BR>var $sortHead = $table.find('th').filter(':nth-child(' (column 1) ')'); <BR>// 逆ソートを実装します<BR> (newDirection == 1) { <BR>$sortHead .addClass('sorted-asc'); <BR>} else { <BR>$sortHead.addClass('sorted-desc'); <BR> //インターレースカラー関数を呼び出します<BR>$table .alternateRowColors($table); <BR>//並べ替えられた列のスタイルを削除し、現在の列にスタイルを追加します <BR>$table.find('td' ).removeClass('sorted').filter(': nth-child(' (列 1) ')').addClass('sorted'); <BR>$table.trigger('repaginate'); }); <BR>} <BR>}); <BR>//ページング<BR>$('table.paginated' ).each(function() { <BR>var currentPage = 0; <BR>var numPerPage = 10; <BR>var $table = $(this); <BR>$table.bind('repaginate', function( ) { <BR>$table.find('tbody tr ').hide().slice(currentPage * numPerPage, (currentPage 1) * numPerPage).show(); <BR>var numRows = $table.find('tbody tr').length; <BR>var numPages = Math.ceil(numRows / numPerPage); <BR>var $pager = $('<div class="pager">< /div>'); <BR>for (var page = 0; page < numPages; page ) { <BR>$('<span class="page-number">')。 text(ページ 1) <BR>.bind('click ', { newPage: page }, function(event) { <BR>currentPage =event.data['newPage']; <BR>$table.trigger('repaginate) '); <BR>$(this).addClass( 'active').siblings().removeClass('active'); <BR>}).appendTo($pager).addClass('clickable'); >} <BR>$pager.insertBefore($table) ; <BR>$table.trigger('repaginate'); <BR>$pager.find('span.page-number:first').addClass('active '); <BR>}); <BR>} ); <BR><BR><BR><BR> パッケージのダウンロード アドレス</script> </div> </div>