<div class="codetitle"> <span><a style="CURSOR: pointer" data="74952" class="copybut" id="copybut74952" onclick="doCopy('code74952')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code74952"> <br><script type="text/javascript"> <BR>$(function(){ <BR>var n =$('.fenye >ul li:nth-child').length <BR>var c=$(".fenye ul li").index($('.fenye ul li.thisclass')) <BR>var setp1=c <BR>var setp2=n-c; //后余 <BR>if(n>10){ <BR>if(c>2){ <BR>for (i=2;i<parseInt(c);i++){ <BR>$(".fenye ul li").eq(i).hide() <BR>} <BR>} <BR>for(y=c+5;y<setp2+3;y++){ <BR>$(".fenye ul li").eq(y).hide() <BR>} <BR>$(".fenye ul li").eq(n-3).text('...'); <BR>}else if(n==10){ <BR>$(".fenye ul li").eq(n-3).text('...'); <BR>} <br><br>}) <BR></script> <br><div class="fenye"> <br><ul class="clear"> <br><li href="#"><a href="#"><img src="/templets/mysite/images/tubiao2.jpg" alt="用客户端js实现带省略号的分页_javascript技巧" ></a></li> <br><li href="#"><a href="#"><img src="/templets/mysite/images/tubiao3.jpg" alt="用客户端js实现带省略号的分页_javascript技巧" ></a></li> <br><li><a href="list_3_14.html">141</a></li> <br><li><a href="list_3_14.html">1432</a></li> <br><li><a href="list_3_14.html">143</a></li> <br><li><a href="list_3_14.html">143</a></li> <br><li class="thisclass">13</li> <br><li><a href="list_3_14.html">14</a></li> <br><li><a href="list_3_11.html">11</a></li> <br><li><a href="list_3_15.html">1512</a></li> <br><li><a href="list_3_15.html">1513</a></li> <br><li><a href="list_3_15.html">151</a></li> <br><li><a href="list_3_15.html">151</a></li> <br><li><a href="list_3_15.html">152</a></li> <br><li><a href="list_3_15.html">152</a></li> <br><li><a href="list_3_15.html">152</a></li> <br><li><a href="list_3_15.html">152</a></li> <br><li><a href="list_3_15.html">153</a></li> <br><li><a href="list_3_15.html">154</a></li> <br><li><a href="list_3_15.html">155</a></li> <br><li href="#"><a href="#"><img src="/templets/mysite/images/tubiao4.jpg" alt="用客户端js实现带省略号的分页_javascript技巧" ></a></li> <br><li href="#"><a href="#"><img src="/templets/mysite/images/tubiao5.jpg" alt="用客户端js实现带省略号的分页_javascript技巧" ></a></li> <br> </ul> <br> </div> <br> </div> <br>效果图<br><img src="http://files.jb51.net/file_images/article/201304/2013427142139335.jpg?201332714229" alt="用客户端js实现带省略号的分页_javascript技巧" >