用tbody代替div 解决 table tr的隐藏问题
来源:互联网 发布:javascript not 编辑:程序博客网 时间:2024/05/21 19:29
有如下需求,需要控制一个table内几个tr的显示问题。一开始想的方法是在这几个要显示的tr外面套一个div,利用div的display:none属性来解决。 但是后来发现div和tr嵌套的时候会有问题。例如,如果我的html页面是这样的源码:view plaincopy to clipboardprint?
<html>
<head>
</head>
<body>
<table>
<div id="borrowAccountDiv_CJ" style="display:none;" mce_style="display:none;">
<tr>
<td>借方帐号:</td>
</tr>
<tr>
<td><input type="text" id="borrowAcount" name="borrowAcount" style="width:200px;" dataType="MoneyRequire" msg="借方帐号不能够为空,且必须为数字!"onclick="this.select()"/><fontcolor="#FF0000"> *</font></td>
</tr>
</div>
</table>
</body>
</html>
那么打开这个html页面后,发现DIV中的tr还是会显示。
后来才发现,其实div和tr的相互嵌套是有问题。所以可以用tbody来代替实现。实现后的代码如下:
view plaincopy to clipboardprint?
<html>
<head>
</head>
<body>
<table>
<tbody id="borrowAccountDiv_CJ" style="display:none;" mce_style="display:none;">
<tr>
<td>借方帐号:</td>
</tr>
<tr>
<td><input type="text" id="borrowAcount" name="borrowAcount" style="width:200px;" dataType="MoneyRequire" msg="借方帐号不能够为空,且必须为数字!"onclick="this.select()"/><fontcolor="#FF0000"> *</font></td>
</tr>
</tbody>
</table>
</body>
</html>
如果要分别隐藏多段tr,可以在table加入多个tbody,进行分别隐藏。table是支持多个tbody的哟。
- 用tbody代替div 解决 table tr的隐藏问题
- 用tbody代替div 解决 table tr的隐藏问题
- 用tbody代替div 解决 table tr的隐藏问题
- 表格中tr的隐藏与显示问题使用tbody解决
- 用tbody解决div在table标签里无法隐藏某些行
- table tbody tr
- 根据div 标签 查看数组@class=modulwrap 下面的/table/tbody/tr/td
- 用tbody和div隐藏和展开页面的效果
- table的thead/tbody/tfoot/tr/th/t…
- table的thead/tbody/tfoot/tr/th/td
- 动态显示隐藏tbody/div
- 动态显示,隐藏Table的tr
- html标签的表格的tbody、tfoot、thead、colgroup、th、tr、td、table
- 关于tr隐藏的问题
- tr的显示隐藏问题
- 隐藏的<tbody>
- 关于table中一个隐藏的tr,改为显示后与其他tr样式不一样的问题
- Jquery-1.3.2在IE8中用toggle控制table 的 tr td显示和隐藏问题
- 多对多关联的例子
- 报错SQL state [null]; error code [17027]; 流已被关闭; nested exception is java.sql.SQLException: 流已被关闭
- html---备忘基础
- poj1007玛雅历
- linux5------vi编辑器的使用、命令
- 用tbody代替div 解决 table tr的隐藏问题
- Java正则表达式教程
- a different object with the same identifier value was already associated with the session 深入分析
- root 运行 Google Chrome
- div被选择框select遮挡住的5种解决方法
- SharePoint网站搜索不到任何内容
- Web——HTML5特性检测
- QQ在线客服代码 飘浮在右侧的QQ客服js特效演示
- 如何在asp.net使用Javascript