<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<script src="../../BOOK/书籍/Jquery/jquery-1.3.2.js"></script>
<script type="text/jscript">
$(".has_children").click(function(){
$(this).addClass("highlight")
.children("a").show().end()
.siblings().removeClass("highlight")
.children("a").hide();
});
</script>
<title>导航栏</title>
<style type="text/css">
#menu{width:300px;}
.has_children{ background:#555; color:#fff; cursor: pointer;}
.highlight{ color:#fff; background: green;}
div{ padding:0; margin:10px 0;}
a{ background:#888; display:none; float:left; width:300px;}
</style>
</head><body> <div id="menu">
<div class="has_children">
<span>第一章、认识JQuery</span>
<a>1.1-JavaScript和JavaScript库</a>
<a>1.2-加入Jquery</a>
<a>1.3-编写简单Jquery代码</a>
<a>1.4-Jquery对象和DOM对象</a>
<a>1.5-解决Jquery和其他库的冲突</a>
<a>1.6-Jquery开发工具和插件呢</a>
<a>1.7-小结</a>
</div>
<div class="has_children">
<span>第二章、认识选择器</span>
<a>2.1-Jquery的选择器是什么</a>
<a>2.2-Jquery的选择器的优势</a>
<a>2.3-Jquery选择器</a>
<a>2.4-应用Jquery改写实例</a>
<a>2.5-选择器的一些注意事项</a>
<a>2.6-案例研发——类似淘宝网品牌的列表效果</a>
<a>2.7-还有其他的选择器吗</a>
<a>2.8-小结</a>
</div>
<div class="has_children">
<span>第三章、Jquery中的DOM操作</span>
<a>3.1-DOM操作分类</a>
<a>3.2-Jquery中的DOM操作</a>
<a>3.3-案例研发——某网站超链接和图片提示效果</a>
<a>3.4-小结</a>
</div>
</div>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<script src="../../BOOK/书籍/Jquery/jquery-1.3.2.js"></script>
<script type="text/jscript">
$(".has_children").click(function(){
$(this).addClass("highlight")
.children("a").show().end()
.siblings().removeClass("highlight")
.children("a").hide();
});
</script>
<title>导航栏</title>
<style type="text/css">
#menu{width:300px;}
.has_children{ background:#555; color:#fff; cursor: pointer;}
.highlight{ color:#fff; background: green;}
div{ padding:0; margin:10px 0;}
a{ background:#888; display:none; float:left; width:300px;}
</style>
</head><body> <div id="menu">
<div class="has_children">
<span>第一章、认识JQuery</span>
<a>1.1-JavaScript和JavaScript库</a>
<a>1.2-加入Jquery</a>
<a>1.3-编写简单Jquery代码</a>
<a>1.4-Jquery对象和DOM对象</a>
<a>1.5-解决Jquery和其他库的冲突</a>
<a>1.6-Jquery开发工具和插件呢</a>
<a>1.7-小结</a>
</div>
<div class="has_children">
<span>第二章、认识选择器</span>
<a>2.1-Jquery的选择器是什么</a>
<a>2.2-Jquery的选择器的优势</a>
<a>2.3-Jquery选择器</a>
<a>2.4-应用Jquery改写实例</a>
<a>2.5-选择器的一些注意事项</a>
<a>2.6-案例研发——类似淘宝网品牌的列表效果</a>
<a>2.7-还有其他的选择器吗</a>
<a>2.8-小结</a>
</div>
<div class="has_children">
<span>第三章、Jquery中的DOM操作</span>
<a>3.1-DOM操作分类</a>
<a>3.2-Jquery中的DOM操作</a>
<a>3.3-案例研发——某网站超链接和图片提示效果</a>
<a>3.4-小结</a>
</div>
</div>
</body>
</html>
解决方案 »
- 请大家帮我改下 层 菜单 谢谢!!!在线等
- 动态修改table的问题
- 请各位高用帮忙!!!!!
- 如何判断<input name="file" type="file" id="file" style="width:400px" value="">的值为空?
- 请教高手个问题,很急!!!!!!
- 100分,不够再加,我想在客户端调用扫描仪的应用程序,急急急急急急急。
- 我js菜鸟,问一个简单问题^_^
- 高手非高手都可进********************如何实现查找字符串中的唯一一个字母?*****************
- 如何能让select单选框用javascript来确定选中哪个(自动选)...??
- js如何获取时间范围内的年月
- 网上复制的js交互代码 怎么在同一个页面 重复使用呢
- jQuery,选项卡函数,看不懂
<script type="text/jscript">
$(function(){
$(".has_children").click(function(){
$(this).addClass("highlight")
.children("a").show().end()
.siblings().removeClass("highlight")
.children("a").hide();
});
});
</script>
1、使用live来绑定,如$(".has_children").live('click',***);
2、跟ucjatteyma说的一样,在domReady的时候注册 $(function(){$(".has_children").click(****); });
$(".has_children").click(function(){
$(this).addClass("highlight").children("a").show().end().siblings().removeClass("highlight").children("a").hide();
});
});