This example is exactly what i need, but it's have a bug when using Opera (9.25 on my computer)
Does anybody now some other code like that?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Show/Hide columns for Ciklum CRM</title>
<script language="javascript">
function show_hide_column(btn,col_no) {
btn = document.forms['tcol'].elements[btn];
stl = btn.checked ? '' : 'none';
var tbl = document.getElementById('table_id');
var rows = tbl.getElementsByTagName('tr');
for (var row=0; row<rows.length;row++) {
var cels = rows[row].getElementsByTagName('td');
cels[col_no-1].style.display=stl;
}
}
</script>
</head>
<body>
<table id="table_id" width="100%" border=1>
<tr>
<td bgcolor="#666666" class="bold">column 1 text</td>
<td bgcolor="#99FF00">column 2 text</td>
<td bgcolor="#CC6633" class="italic">column 3 text</td>
<td bgcolor="#FFFF33">column 4 text</td>
</tr>
<tr>
<td bgcolor="#666666" class="bold">column 1 text</td>
<td bgcolor="#99FF00">column 2 text</td>
<td bgcolor="#CC6633" class="italic">column 3 text</td>
<td bgcolor="#FFFF33">column 4 text</td>
</tr>
<tr>
<td bgcolor="#666666" class="bold">column 1 text</td>
<td bgcolor="#99FF00">column 2 text</td>
<td bgcolor="#CC6633" class="italic">column 3 text</td>
<td bgcolor="#FFFF33">column 4 text</td>
</tr>
</table>
<p> </p>
<p> </p>
<form name="tcol" onsubmit="return false">
Hide/Show columns
<input type=checkbox name="col1" onclick="show_hide_column(this.name,1)" checked> 1
<input type=checkbox name="col2" onclick="show_hide_column(this.name,2)" checked> 2
<input type=checkbox name="col3" onclick="show_hide_column(this.name,3)" checked> 3
<input type=checkbox name="col4" onclick="show_hide_column(this.name,4)" checked> 4
</form>
</body>
</html>
Comment