table有若干列P0 P1, P2 P3 P4 P5 P6 P7 P8如何实现点P0隐藏P1,P2,P3,P4
点击P5 ,隐藏P6,P7,P8再次点击则显示出来
这可以实现吗?
点击P5 ,隐藏P6,P7,P8再次点击则显示出来
这可以实现吗?
解决方案 »
- 关于Ext window的tbar 在加载页面过大时,滚动条下拉后看不到了
- 我用的JS代码为什么会找不到图片?
- 关闭浏览器时部分cookie丢失,何解?
- 下面这个正则式啥意思啊??? Eaeflnr <--这是啥玩意????
- 有关点击打印按钮存储当前页数据的问题
- 做好的js脚本图片切换特效自己可以看但是其他电脑看图片是叉叉请大家帮助
- javascript读取cookies(急!!!!)
- 在checkbox列表中,按shift多选的问题。来者有分
- 我发现我的代码中出现这样几句不明代码?请问是做什么用的?
- 求一个算法,字符串替换成数字。
- jquery改变<input id='txt1' type='text'/> 的值,如何触发txt1的事件?
- JavaScript字符包含问题
<html>
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312" />
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.9.0/build/reset/reset-min.css">
<style type="text/css"><!--
body { font-size:12px; font-family:"宋体"; }
.wrapper { margin:10px auto; width:700px; }
table {
font-size:20px;
}
td{
padding:10px;
border:1px solid green;
}
--></style>
</head>
<body>
<div class="wrapper">
<table>
<tr>
<td>第一章</td>
<td>1-1</td>
<td>1-2</td>
<td>1-3</td>
<td>第二章</td>
<td>2-1</td>
<td>2-2</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
</tr>
</table>
</div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
<script type="text/javascript">//<![CDATA[
$(function(){
$('tr:first td:first').click(function(){
if( $(this).next().is(':visible') ){
$('tr').each(function(){
$(this).find('td:gt(0):lt(3)').hide();
})
}else{
$('tr').each(function(){
$(this).find('td:gt(0):lt(3)').show();
})
}
})
$('tr:first td:eq(4)').click(function(){
if( $(this).next().is(':visible') ){
$('tr').each(function(){
$(this).find('td:gt(4)').hide();
})
}else{
$('tr').each(function(){
$(this).find('td:gt(4)').show();
})
}
})
})
//]]></script>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.1.min.js"></script>
<style type="text/css">
table { border-collapse:collapse; }
td { border:1px solid #CCC; font:12px Tahoma, Geneva, sans-serif; text-align:center; width:50px; }
</style><script type="text/javascript">
$(document).ready(function() {
$("td:eq(0)").toggle(
function() {
$("td").each(function() {
if ($(this).index() % 9 >= 1 && $(this).index() % 9 <= 4) $(this).hide();
});
}, function() {
$("td").each(function() {
if ($(this).index() % 9 >= 1 && $(this).index() % 9 <= 4) $(this).show();
});
});
$("td:eq(5)").toggle(function() {
$("td").each(function() {
if ($(this).index() % 9 >= 6 && $(this).index() % 9 <= 8) $(this).hide();
});
}, function() {
$("td").each(function() {
if ($(this).index() % 9 >= 6 && $(this).index() % 9 <= 8) $(this).show();
});
});
});</script>
</head><body>
<table border="0">
<tr>
<td>P0</td>
<td>P1</td>
<td>P2</td>
<td>P3</td>
<td>P4</td>
<td>P5</td>
<td>P6</td>
<td>P7</td>
<td>P8</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</body>
</html>
$('#P0').click(function(){
if($('#p1').show()){
$('#p1').hide();
$('#p2').hide();
$('#p3').hide();
$('#p4').hide();
}else{
$('#p1').show();
$('#p2').show();
$('#p3').show();
$('#p4').show(); }
})
})给个思路给你
sounds funny
not noting.
write less, do more
我是说淡入淡出我记得有toggle(1000) 1秒这样子可以做到吗
.fadeOut("1000");
淡入淡出是这个 。
hide('slow')、show('slow')用在表格里面貌似会有点问题,每次会出现空隙,而且这个空隙会累积增加。