<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>表格的展开与关闭</title>
<style>
.type{
background-color:lightblue;
text-align:center;
}
.selected{
background-color:pink;
}
</style>
<script type="text/javascript" src="../js/jquery-1.11.1.min.js"></script>
<script type="text/javascript">
$(function(){
$("tr.type").click(function(){
$(this).toggleClass("selected").siblings(".line_"+this.id).toggle();
})
})
</script>
</head>
<body>
<table border="1" align="center" width="405">
<caption>JavaScript开发非常之旅套系图书</caption>
<thead bgcolor="#B2B2B2" align="center" valign="bottom">
<tr>
<th width="185">书名</th>
<th width="220">出版单位</th>
</tr>
</thead>
<tbody>
<tr class="type" id="t1">
<td colspan="2">JavaScript书籍</td>
</tr>
<tr class="line_t1">
<td width="185">JavaScript从入门到精通</td>
<td width="220">吉林省明日科技有限公司</td>
</tr>
<tr class="line_t1">
<td>JavaScript自学视频教程</td>
<td>吉林省明日科技有限公司</td>
</tr>
<tr class="line_t1">
<td>JavaScript程序设计</td>
<td>吉林省明日科技有限公司</td>
</tr>
<tr class="type" id="t2">
<td colspan="2">jQuery书籍</td>
</tr>
<tr class="line_t2">
<td>jQuery开发基础教程</td>
<td>吉林省明日科技有限公司</td>
</tr>
<tr class="line_t2">
<td>jQuery从入门到精通</td>
<td>吉林省明日科技有限公司</td>
</tr>
</tbody>
</table>
</body>
</html>