日期:2014-05-16 浏览次数:20337 次
<h3>标题一</h3>
<div class="div1">标题一简单描述</div>
<table id="tab_box" class="tab">
<tr>
<td>标题一内容</td>
</tr>
</table>
<h3>标题二</h3>
<div class="div1">标题二简单描述</div>
<table id="tab_box" class="tab">
<tr>
<td>标题二内容</td>
</tr>
</table>
<h3>标题三</h3>
<div class="div1">标题三简单描述</div>
<table id="tab_box" class="tab">
<tr>
<td>标题三内容</td>
</tr>
</table>
$(document).ready(function(){
$('h3').click(function(){
$(this).next('.tab').slideToggle().siblings('.tab').slideUp();
});
})
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#tab_box2").hide();
$("#tab_box3").hide();
$("h3").click(function() {
$(this).parent().siblings().children(".tab").hide();
$(this).next().next().show();
})
})
</script>
</head>
<body>
<div>
<h3>标题一</h3>
<div class="div1">标题一简单描述</div>
<table id="tab_box1" class="ta