<img src="http://files.jb51.net/file_images/article/201310/20131018111620.gif?2013918111637" alt="用jquery统计子菜单的条数示例代码_jquery" > <br>jquery tab特效~ (类似选项卡)<a href="http://www.jb51.net/article/42151.htm" target="_blank">http://www.jb51.net/article/42151.htm</a> <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="87714" class="copybut" id="copybut87714" onclick="doCopy('code87714')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code87714"> <br> <br> <br> <br><meta charset="UTF-8"> <br><title>Tabs</title> <br><style type="text/css"> <BR>/* Remove margin padding */ <BR>body,h1,h2,h3,h4,h5,h6,hr,p,blockquote,dl,dt,dd,ul,ol,li,pre,form,fieldset,legend,button,input,textarea,th,td { margin:0; padding:0; } <br><br>/* Default Font */ <BR>body,button,input,select,textarea { font:12px/1.5 \5b8b\4f53,arial,sans-serif; } <BR>h1,h2,h3,h4,h5,h6 { font-size:100%; } <BR>address,cite,dfn,em,var { font-style:normal; } <BR>code,kbd,pre,samp { font-family:courier new,courier,monospace; } <BR>small { font-size:12px; } <BR>ul,ol { list-style:none; } <BR>a { text-decoration:none; } <BR>a:hover { text-decoration:underline; } <BR>sup { vertical-align:text-top; } <BR>sub { vertical-align:text-bottom; } <BR>legend { color:#000; } <BR>fieldset,img { border:0; } <BR>button,input,select,textarea{ font-size:100%; } <BR>table { border-collapse:collapse; border-spacing:0; } <br><br>.col-main{ float:left; width:100%; min-height:1px; } <BR>.col-sub,.col-extra { float:left; } <BR>.layout:after,.main-wrap:after,.col-sub:after,.col-extra:after { content:'\20'; display:block; height:0; clear:both; } <BR>.layout,.main-wrap,.col-sub,.col-extra { zoom:1; } <br><br>/* Common Features */ <BR>.hidden { display:none; } <BR>.invisible { visibility:hidden; } <br><br>/* Remove Float */ <BR>.clear { display:block; height:0; overflow:hidden; clear:both; } <BR>.clearfix:after { content:'\20'; display:block; height:0; clear:both; } <BR>.clearfix { *zoom:1; } <br><br>/* For non ie browsers also display the vertical scroll bar by default, to prevent the flicker caused by the scroll bar */ <BR>html { overflow-y:scroll; } <br><br>/* Default link styles */ <BR>a:link {color: #003399; } <BR>a:visited {color: #123689;} <BR>a:hover {color: #FF6600;} <BR></style> <br> <br> <br><br><style type="text/css"> <BR>.menu { width:200px; border:1px solid #CCC; margin-bottom:20px } <BR>.menu h3 { height:30px; line-height:30px; background:#ccc; } <BR>.menu .num { font-weight:bold; color:red; padding-left:30px; } <BR></style> <br><br><div class="menu"> <br><h3>系统设置 <span class="num"></span> </h3> <br><ul> <br><li>菜单1</li> <br><li>菜单2</li> <br><li>菜单3</li> <br><li>菜单4</li> <br><li>菜单5</li> <br><li>菜单6</li> <br> </ul> <br> </div> <br><br><div class="menu"> <br><h3>菜单设置2 <span class="num"></span> </h3> <br><ul> <br><li>菜单1</li> <br><li>菜单2</li> <br><li>菜单3</li> <br><br> </ul> <br> </div> <br><br><div class="menu"> <br><h3>菜单设置3 <span class="num"></span> </h3> <br><ul> <br><li>菜单1</li> <br><li>菜单2</li> <br><li>菜单3</li> <br><li>菜单4</li> <br><br><li>菜单5</li> <br> </ul> <br> </div> <br><br><br><script type="text/javascript" src="jquery.js"></script> <br><script type="text/javascript"> <BR>for ( var i=0; i<$('.menu').length; i++){ <BR>var num = $('.menu').eq(i).children('ul').children('li').length; <BR>$('.menu').eq(i).find('.num').text(num); <BR>} <BR></script> <br> <br> <br> </div>