1

我正在使用单选按钮,当用户单击它时,将显示表格中的一行,我使用了style="display:none;" 隐藏它并在 Javascript 中显示下面的代码:

document.getElementById("testId").style.display = "inline";

问题在于它的显示方式,因为我刚刚注册,所以无法上传显示方式的图片,但我会尽可能多地展示它。

----------------------------------------------------------------
this is before 
----------------------------------------------------------------
this is test test test test | this is the row
----------------------------------------------------------------

******************

--------------------------------------------------
this is after showing it with inline
--------------------------------------------------
this | this is the row
 is  |
test |
test |
test |
test |

我还注意到这种显示这一行的方式只发生在 IE 以外的浏览器中!有没有办法解决这个问题?

4

1 回答 1

2

我用了 style="display:none;" 隐藏它和下面的代码在java脚本中显示它

document.getElementById("testId").style.display = "inline";

inline不是表格行的正确初始显示值——table-row当然是 。

但是由于旧的 IE 不能正确理解这一点,你应该把它设置为一个空字符串,

document.getElementById("testId").style.display = "";

– 这将使浏览器简单地将显示样式重置为浏览器认为是表格行的正确默认显示值。

于 2013-10-29T07:33:12.763 回答