点击展开详细信息按钮,显示/隐藏该条数据详细信息,下面是源代码,仅供参考!
<html>
<head>
<style>
.panel {
background-color:green;
width : 600px;
height : 80px;
display:none;
}
.tips{
width:60px;
}
th,td{
border:1px solid blue;
margin:0px 10px;
border-bottom:none;
}
table{
border-collapse:collapse;
border:1px solid blue;
cellspacing:0px;
cellpadding:0px;
}
</style>
<script src="jquery.js"></script>
<script>
$(document).ready(function(){
$(".tips").parents("tr").next().find(".panel").parents().parents("tr").hide();
$(".tips").click(function(){
$(this).parents("tr").next().find(".panel").toggle();
$(this).parents("tr").next().find(".panel").parents().parents("tr").toggle();
//$(".panel").toggle();//
});
});
</script>
</head>
<body align="center">
<h2>
效果演示
</h2>
<table align="center" width="600px;">
<tr>
<td>123</td>
<td>456</td>
<td>798</td>
<td>000</td>
<td class="tips">
<input type="button" value="展开详细信息"/>
</td>
</tr>
<tr >
<td colspan="5">
<div class="panel">
This is my testing page
</div>
</td>
</tr>
<tr>
<td>123</td>
<td>456</td>
<td>798</td>
<td>000</td>
<td class="tips">
<input type="button" value="展开详细信息"/>
</td>
</tr>
<tr>
<td colspan="5">
<div class="panel">
This is my testing page
</div>
</td>
</tr>
<table>
</body>
</html>
//记得引用jQuery插件....