<div class="codetitle"> <span><a style="CURSOR: pointer" data="6647" class="copybut" id="copybut6647" onclick="doCopy('code6647')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code6647"> <br>pageEncoding="UTF-8"%> <br> <br> <br> <br><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <br><title>jqueryMenu</title> <br><script type="text/javascript" src="js/jquery-1.10.2.js"></script> <br><script type="text/javascript"> <BR>$(document).ready(function(){ <BR>var allMenu=$("ul > a");//找到所有主菜单 <BR>allMenu.click(function(){ <BR>var list=$(this).nextAll('li');//找到当前被点击a节点的所有li兄弟节点 <BR>list.toggle('show'); <BR>}); <BR>}); <BR></script> <br> <br> <br><ul> <a href="#">菜单一</a> <br><li><a href="#">子菜单一</a></li> <br><li><a href="#">子菜单二</a></li> <br> </ul> <br><ul> <a href="#">菜单二</a> <br><li><a href="#">子菜单一</a></li> <br><li><a href="#">子菜单二</a></li> <br> </ul> <br> <br> <br> </div>