自己做了一个WEB参数配置页面,有多个text输入框,需要根据其它选项决定是否需要将这些输入框隐藏起来:
<tr>
<td bgcolor="#EFEFEF" align="center" width="250"><strong><span class="alpha">Key 1</span>:</strong></td>
<td bgcolor="#FFFFFF">
<font face="Arial" color="#000000">
<input type="password" id="key_1" name="szwep_key_1" value="##szwep_key_1##" size="32">
</font>
</td>
</tr>
<tr>
<td bgcolor="#EFEFEF" align="center" width="250"><strong><span class="alpha">Key 2</span>:</strong></td>
<td bgcolor="#FFFFFF">
<font face="Arial" color="#000000">
<input type="password" id="key_2" name="szwep_key_2" value="##szwep_key_2##" size="32">
</font>
</td>
</tr>
<tr>
<td bgcolor="#EFEFEF" align="center" width="250"><strong><span class="alpha">Key 3</span>:</strong></td>
<td bgcolor="#FFFFFF">
<font face="Arial" color="#000000">
<input type="password" id="key_3" name="szwep_key_3" value="##szwep_key_3##" size="32">
</font>
</td>
</tr>
<tr>
<td bgcolor="#EFEFEF" align="center" width="250"><strong><span class="alpha">Key 4</span>:</strong></td>
<td bgcolor="#FFFFFF">
<font face="Arial" color="#000000">
<input type="password" id="key_4" name="szwep_key_4" value="##szwep_key_4##" size="32">
</font>
</td>
</tr>
在实现过程中原本打算直接在原来代码的基础上添加一个<tr ></tr>控件,将原来所有的代码都包含在这个<tr >控件里面,然后使用style=display:none将需要包含的控件都隐藏以来。实际测试发现这个无法隐藏,反复验证发现<tr>嵌套后,最外层的style=display:none不起作用
最后使用<tbody>代替<tr>,使用style=display:none可以隐藏<tbody>内部包含的其它控件