ITeye博客

firefox显示隐藏的tr

floydd · 2008-01-31 13:37 · Markdown

以下这段代码在ie下工作的很好,可是ff不行;

functiontoggleTableRow()...{

vartr1=document.getElementById('tr1');
if(tr1.style.display=='none')...tr1.style.display='block';
else... tr1.style.display='none';
returnfalse;

}

哪里错了呢:if (tr1.style.display=='none') {tr1.style.display='block';} 这行吧block 改成 table-row 就好了。
ff对table的tr的display定义比较规范严格,所以需要设置tr1.style.display='table-row';当然也可以简单的这样设置tr1.style.display=‘’,意思是设置为默认的现实属性,而不是block.

为什么ie是好呢?网上说是因为ie能够修正你设置的 类block元素 的display属性(设置错了也不要紧:()
具体看这里:http://rubyol.javaeye.com/blog/140870

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。