通过查询出结果。例如
title1 title2 title3 title4
1 11 33 44
2 22 tr 5t
3 44 et 54f
4 33 rr 444
这个表。我想点击表头 title2 出现下拉菜单后点击隐藏
然后整列隐藏。变成这样.
最后打印。望赐教
title1 title3 title4
1 33 44
2 tr 5t
3 et 54f
4 rr 444
[CODE]<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<script language="javascript">
function dis(n)
{
if (n==0)
{
this.t1[0].style.display="block";
this.t1[1].style.display="block";
this.t1[2].style.display="block";
this.t2[0].style.display="block";
this.t2[1].style.display="block";
this.t2[2].style.display="block";
this.t3[0].style.display="block";
this.t3[1].style.display="block";
this.t3[2].style.display="block";
return false;
}
if (n==1)
{
this.t1[0].style.display="none";
this.t1[1].style.display="none";
this.t1[2].style.display="none";
return false;
}
if (n==2)
{
this.t2[0].style.display="none";
this.t2[1].style.display="none";
this.t2[2].style.display="none";
return false;
}
if (n==3)
{
this.t3[0].style.display="none";
this.t3[1].style.display="none";
this.t3[2].style.display="none";
return false;
}
}
</script>
<table border="1" cellpadding="0" cellspacing="0">
<tr>
<td id="t1">1. <a href="#" onclick="dis(1)">隐藏</a></td>
<td width="92" id="t2">2. <a href="#" onclick="dis(2)">隐藏</a></td>
<td width="108" id="t3">3. <a href="#" onclick="dis(3)">隐藏</a></td>
</tr>
<tr>
<td width="84" id="t1">11111</td>
<td id="t2">22222</td>
<td id="t3">33333</td>
</tr>
<tr>
<td width="84" id="t1">11111</td>
<td id="t2">22222</td>
<td id="t3">33333</td>
</tr>
</table>
<p><a href="#" onclick="dis(0)">全部显示</a></p>
</body>
</html>[/CODE]