Posted in Javascript onAugust 09, 2013
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>jqueryMenu</title> <script type="text/javascript" src="js/jquery-1.10.2.js"></script> <script type="text/javascript"> $(document).ready(function(){ var allMenu=$("ul > a");//找到所有主菜单 allMenu.click(function(){ var list=$(this).nextAll('li');//找到当前被点击a节点的所有li兄弟节点 list.toggle('show'); }); }); </script> </head> <body> <ul><a href="#">菜单一</a> <li><a href="#">子菜单一</a></li> <li><a href="#">子菜单二</a></li> </ul> <ul><a href="#">菜单二</a> <li><a href="#">子菜单一</a></li> <li><a href="#">子菜单二</a></li> </ul> </body> </html>
jquery 利用show和hidden实现级联菜单示例代码
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@