此行我设置了每一个单元格的宽度,但无数据,想隐藏它,如果用
1<tr style="display:none">...</tr>
那么所设置的宽度就无效了,如何做到即隐藏又是宽度有效,height=0没有用,谢谢!
---------------------------------------------------------------
try
1<tr style="visibility:hidden">..
2\---------------------------------------------------------------
3
4<tr style="visibility:hidden">..
5仅隐藏内容
6
7<tr style="display:noe">..
8完全不显示
9\---------------------------------------------------------------
10
11<body>
12<table>
13<tr><td width="100">123</td><td width="100">456</td><td width="100">789</td></tr>
14<tr><td>abc</td><td>def</td><td>ghi</td></tr>
15<tr><td>jkl</td><td>mno</td><td>pqr</td></tr>
16</table>
17<br/>
18<script language="JavaScript">
19<!--
20with(document.all.tags('table')[0].rows[1]){
21for (i=0;i<cells.length;i++)
22cells[i].width=cells[i].offsetWidth;
23}
24//-->
25</script>
26<button onclick="with(document.all.tags('table')[0].rows[0].style){display=display==''?'none':''}">test</button>
27</body>
28
29\---------------------------------------------------------------
30
31在每一个table的最上面用col标签定义宽度。col的使用例子:
32
33<html>
34<body>
35<table border="2" rules="groups">
36<!-- RULES is set to "groups", which has no effect in this sample. For this
37attribute to work, you must use COLSPAN to define the groups of columns.-->
38<col span="2" style="color:red"/>
39<col style="color:blue"/>
40<tr>
41<td>This column is in the first group.</td>
42<td>This column is in the first group.</td>
43<td>This column is in the second group.</td>
44</tr>
45<tr>
46<td>This column is in the first group.</td>
47<td>This column is in the first group.</td>
48<td>This column is in the second group.</td>
49</tr>
50</table>
51</body>
52</html></tr></tr></tr>