-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
68 lines (61 loc) · 1.47 KB
/
test.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript" src="./jquery/js/jquery-1.5.1.min.js"></script>
<table>
<thead>
<tr>
<th class="col1">col1 <a class="hide"
href="javascript:;" onclick="hideCol('col1');">x</a></th>
<th class="col2">col2 <a class="hide"
href="javascript:;" onclick="hideCol('col2');">x</a></th>
<th class="col3">col3 <a class="hide"
href="javascript:;" onclick="hideCol('col3');">x</a></th>
<th class="col4">col4 <a class="hide"
href="javascript:;" onclick="hideCol('col4');">x</a></th>
</tr>
</thead>
<tbody>
<tr>
<td class="col1">data1</td>
<td class="col2">data2</td>
<td class="col3">data3</td>
<td class="col4">data4</td>
</tr>
<tr>
<td class="col1">data1</td>
<td class="col2">data2</td>
<td class="col3">data3</td>
<td class="col4">data4</td>
</tr>
<tr>
<td class="col1">data1</td>
<td class="col2">data2</td>
<td class="col3">data3</td>
<td class="col4">data4</td>
</tr>
</tbody>
</table>
<ul id="hiddenCols"></ul>
<script>
function hideCol(columnClass){
$('table .'+columnClass).each(function(index) {
$(this).hide();
});
$('ul#hiddenCols').append('<li id="'+columnClass
+'"><a href="javascript:;" onclick="showCol(\''
+columnClass+'\');">Show '+columnClass+'</a></li>');
}
function showCol(columnClass){
$('table .'+columnClass).each(function(index) {
$(this).show();
});
$('li#'+columnClass).remove();
}
</script>
</body>
</html>