《锋利的JQUERY》书中的问题
时间:2010-01-28
来源:互联网
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>New Web Project</title>
<script src="lib/jquery/jquery-1.3.1.js" type="text/javascript"></script>
<script type="text/javascript">
$(".has_children").click(function(){
$(this).addClass("highlight").children("a").show().end().siblings().removeClass("highlight").children("a").hide();
});
</script>
<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;}
div 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 jquery</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>第二章 jquery 选择器</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>
没有出来书中的效果(单击不同的的章节名称链接,显示相应的内容,同时高亮显示当前选择的章节),救解!
作者: aries19 发布时间: 2010-01-28
作者: swlyb 发布时间: 2010-01-30
$(".has_children").click(function(){
$(this).addClass("highlight")
.children("a").show().end()
.siblings().removeClass("highlight")
.children("a").hide();
}) ;
});
作者: xrbx 发布时间: 2010-02-03
作者: qqfreshman 发布时间: 2010-02-03
作者: ywqbestever 发布时间: 2010-02-03
我的代码也按楼上的改过,但还是无法显示。
作者: hnboy 发布时间: 2010-02-22
$(function(){
$(".has_children").click(function(){
$(this).addClass("highlight").children("a").show().end().siblings().removeClass("highlight").children("a").hide();
});
});
作者: peckzeg 发布时间: 2010-02-22
.........
});
后,建议把
<script src="lib/jquery/jquery-1.3.1.js" type="text/javascript"></script>
的src路径简化一下,是不是jQuery框架没引对。
作者: hnboy 发布时间: 2010-02-22
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28