我在这里有这段代码:
<head>
<script language="javascript">
var showMode = 'table-cell';
if (document.all) showMode='block';
function toggleVis(btn){
btn = document.forms['tcol'].elements[btn];
cells = document.getElementsByName('t'+btn.name);
mode = btn.checked ? showMode : 'none';
for(j = 0; j < cells.length; j++) cells[j].style.display = mode;
}
</script>
</head>
<body>
<h1>Andmete kustutamine</h1>
<hr>
<div id="mainbox">
<form name="tcol" onsubmit="return false">
<p id="rand">Kuvatavad tulbad:</p>
<table class="tabl">
<tr>
<td id="nobord"><input type=checkbox name="col1" onclick="toggleVis(this.name)" checked> Osakond</td>
<td id="nobord"><input type=checkbox name="col2" onclick="toggleVis(this.name)" checked> Soetusaasta</td>
<td id="nobord"><input type=checkbox name="col3" onclick="toggleVis(this.name)" checked> IT Number</td>
<td id="nobord"><input type=checkbox name="col4" onclick="toggleVis(this.name)" checked> Tooterühm</td>
</tr>
<tr>
<td id="nobord"><input type=checkbox name="col5" onclick="toggleVis(this.name)" checked> Mudeli nimetus</td>
<td id="nobord"><input type=checkbox name="col6" onclick="toggleVis(this.name)" checked> SN</td>
<td id="nobord"><input type=checkbox name="col7" onclick="toggleVis(this.name)" checked> Riigivara nr</td>
<td id="nobord"><input type=checkbox name="col8" onclick="toggleVis(this.name)" checked> Inventaari nr</td>
</tr>
<td id="nobord"><input type=checkbox name="col9" onclick="toggleVis(this.name)" checked> Maja</td>
<td id="nobord"><input type=checkbox name="col10" onclick="toggleVis(this.name)" checked> Ruum</td>
<td id="nobord"><input type=checkbox name="col11" onclick="toggleVis(this.name)" checked> Vastutaja</td>
<td id="nobord"><input type=checkbox name="col12" onclick="toggleVis(this.name)" checked> Märkus</td>
<tr>
<td id="nobord"><input type=checkbox name="col13" onclick="toggleVis(this.name)" checked> ID</td>
<td id="nobord"><input type=checkbox name="col14" onclick="toggleVis(this.name)" checked> Kasutajanimi</td>
</tr>
</table>
</form>
一旦切换了某个复选框,它就应该隐藏列。我的问题是,每当我重新加载页面时......框中的勾号消失了,柱子又在那里了。有没有办法禁用它?提前致谢!